angular-socket-io icon indicating copy to clipboard operation
angular-socket-io copied to clipboard

able to change Query for reconnect

Open gen4sp opened this issue 11 years ago • 4 comments

just leave a simple access to socket object to able to change query for auto-reconnection

var wrappedSocket = {
          on: addListener,
    socket:socket,                     //this line
    addListener: addListener,
        once: addOnceListener,
...

example of using

this.socket.socket.socket.options.query = '?token='+user_token;

gen4sp avatar May 09 '14 19:05 gen4sp

I'm also really interested accessing the query in order to append the auth token in the socket for authentificate the user through JWT.

This may not be the real way to do it, but don't know another for now

balthazar avatar May 11 '14 09:05 balthazar

Duplicate of #12.

btford avatar May 28 '14 19:05 btford

Actually, this is not a strict duplicate.

If you want to be able to access some property of the socket, the right way is to expose it via a getter. I've described how to do this several times before in other issues.

btford avatar May 28 '14 19:05 btford

@btford i see you had added a setter for the internal socket in #12 but it has since been removed? I filed a similar issue #86, but simply exposing properties of the socket object on the wrapper aren't really a solution for me, as I need to destroy it and reconnect. Providing direct access to the socket in a public property is really the simplest way to go here, IMO.

davisford avatar Oct 26 '14 03:10 davisford