gcrabtree/react-native-socketio

Sending query strings with connect()

Opened this issue · 3 comments

This feature seems to be missing from this package. I checked the code and the connect() method doesn't take any parameters.

With pure socket.io you can do something like this:
io.connect(socketUrl, {query: "email=" + store.get('profile').email + "&type=pc"})

I tried passing the query string like this:
new SocketIO(socketUrl, {query: "email=email@email.com&type=web"});

The above doesn't work though. I'm not able to get the query string on my server.

Same problem with me, please support

Considering this line of code

if connectParams != nil {
            for (key, value) in connectParams! {
                let keyEsc   = key.urlEncode()!
                let valueEsc = "\(value)".urlEncode()!

                queryString += "&\(keyEsc)=\(valueEsc)"
            }
        }

The correct syntax is ==>

this.socket = new SocketIO('http://localhost:3000', { connectParams: {token: "someToken"} })