Skip to content

Sending query strings with connect() #18

Open

Description

@razvanilin

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.

Activity

  1. ThangLuuQuoc commented on Dec 5, 2016

    @ThangLuuQuoc

    Same problem with me, please support

  2. jose920405 commented on Apr 27, 2017

    @jose920405

    +1

  3. jose920405 commented on Apr 27, 2017

    @jose920405

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions