Skip to content

Sending query strings with connect() #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
razvanilin opened this issue Sep 3, 2016 · 3 comments
Open

Sending query strings with connect() #18

razvanilin opened this issue Sep 3, 2016 · 3 comments

Comments

@razvanilin
Copy link

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 protected]&type=web"});

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

@ThangLuuQuoc
Copy link

Same problem with me, please support

@jose920405
Copy link

+1

@jose920405
Copy link

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"} })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants