immutant

http://immutant.org Note: dev discussion happens in #immutant on FreeNode IRC.
bostonaholic 2017-05-11T01:27:57.890462Z

when I try to connect to a secure websocket, wss://... I get a response header Sec-Websocket-Location: ws://...

bostonaholic 2017-05-11T01:28:04.891391Z

any ideas why that might be?

bostonaholic 2017-05-11T01:28:20.893543Z

this is immutant running on heroku

bostonaholic 2017-05-11T01:29:53.906583Z

immutant 2.1.6

bostonaholic 2017-05-11T01:46:44.046379Z

my websocket works fine when I run the server locally, using ws:// but when I deploy and try to access the secure wss://, I get a 1006 code from my JS client

bostonaholic 2017-05-11T14:33:01.990816Z

I think the issue might have been unrelated to websockets and immutant all together. I was banging my head against the wall all day yesterday, unable to get my client to successfully connect to the websocket. I thought it was an issue with not being able to properly connect to a secure wss websocket on Heroku. Then I discovered EventSource and decided to give that a try instead; since I’m really just using the channel for server-side events and nothing from the client is being sent to the server. I was getting an error, but this time an exception was being thrown on the server. Turns out, I forgot to set an environment variable on Heroku to connect to my redis instance. Once I did that, EventSource was working as expected. I suspect the connection exception was being swallowed and not showing up in my logs when using the websocket implementation.

2017-05-11T16:13:18.748970Z

@bostonaholic glad to hear you solved it

bostonaholic 2017-05-11T16:13:43.759340Z

it was a 🤦 moment

2017-05-11T16:19:26.901561Z

🙂

bostonaholic 2017-05-11T17:58:05.312305Z

is there not an :on-close callback for Server-Side Events?

2017-05-11T22:43:18.240256Z

@bostonaholic: sse/as-channel is just an extension of async/as-channel, so should support :on-close. Do you have one, and it's just not getting called?

bostonaholic 2017-05-11T22:45:03.262219Z

it must not have been, or I might have not properly reloaded

2017-05-11T22:45:34.268989Z

It's possible there is a bug there as well - none of our sse tests have an :on-close

bostonaholic 2017-05-11T22:45:54.273144Z

hmmm

2017-05-11T22:46:15.277730Z

I'll throw one on a test and see what happens

bostonaholic 2017-05-11T22:46:16.277935Z

I’ve gone back to using a websocket for the time being, since I know that was working

bostonaholic 2017-05-11T22:46:30.280666Z

I might take a look at using sse again after a while

bostonaholic 2017-05-11T22:46:36.281836Z

thanks!

2017-05-11T22:49:47.319989Z

:on-close isn't getting called for me either

bostonaholic 2017-05-11T22:51:21.339331Z

oh no

2017-05-11T23:28:13.760238Z

hmm, if I close the channel from the server side, :on-close does get called. If I close from the client side and try to send!, that should trigger :on-close as well, I think, but doesn't appear to be

2017-05-11T23:29:58.778063Z

I'm going to file an issue for this

bostonaholic 2017-05-11T23:33:20.813708Z

great, thanks!

2017-05-11T23:33:59.820227Z

we've got a release almost ready (maybe sometime next week?), I'll take a look at this before then

bostonaholic 2017-05-11T23:34:17.823639Z

:thumbsup: