socketio / socket.io-client-swift

Other
5.22k stars 843 forks source link

Help wanted: How to pass in query string when connecting to socketio endpoint? #132

Closed qbig closed 9 years ago

qbig commented 9 years ago

Can just append "?token=xxx" to the socketio url?

nuclearace commented 9 years ago
let socket = SocketIOClient(socketURL: "localhost:8080", opts: ["connectParams": ["thing": "value"]])

You could use connectParams

guapollo commented 9 years ago

what's the object-c way to do this?

nuclearace commented 9 years ago
SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL: @"localhost:8080" opts: @{@"connectParams": @{@"thing": @"value"}}];
guapollo commented 9 years ago

Works! Thanks!

nigharsh commented 7 years ago

Updated for 2017

var socket = SocketIOClient(socketURL: URL(string: "localhost:8080")!, config: [.connectParams(["<key>" : "<value>"])])
mohdsafadsaal commented 6 years ago

Hi , I don't find socket io client with this params. Is there any alternative method to pass query parameters on connect method ?

nuclearace commented 6 years ago

@mohdsafadsaal The config stuff has moved to the SocketManager in the latest version.

anuroopkanayil commented 6 years ago

how to use connect parameters in swift 4

bbdroid commented 6 years ago

@nuclearace Can you please provide the demo using SocketManager? I am getting difficulty to connect to socket server with authorization header. Appreciate your help!

nuclearace commented 6 years ago

@bdavid68 It's crude, but this shows some basic usage: https://github.com/nuclearace/socket.io-client-testing/blob/master/Sources/main.swift