You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to do token based authentication using socket.io and I'm interested in using this library.
The issue I'm running into is that I need to receive the token from the server before making the socket.io connection. The current design seems to require that I both instantiate and connect EmberSocket at the same time, and in my case, before I have the token to connect with.
What do you all think about separating the instantiation and the connection? Ideally I could do something like.
And then in your controller – such as your ApplicationController, manually connect to the WebSockets server using the connect method, passing in any params into the connect method:
Activity
vyobukhov commentedon Aug 28, 2014
I just added jquery.ajax call before $io.connect inside ember-sockets.js
Something like this
Works fine)) I don't know if it's good practice or not.
Added connect method with params arg. Relates to #37
Wildhoney commentedon Aug 30, 2014
I've moved the connection process into a
connectmethod.Defer the connection by setting
autoConnecttofalse.And then in your controller – such as your
ApplicationController, manually connect to the WebSockets server using theconnectmethod, passing in any params into theconnectmethod:Please let me know if this works for you guys! 👍
FreakTheMighty commentedon Sep 2, 2014
Awesome @Wildhoney. I haven't had a chance to try it yet, but that looks like it will work perfectly.