Reputation: 16920
I am using the android-websockets library to connect to our Socket.IO server. The connection is created, but I can't connect to a room.
In javascript, our code looks like this:
emit('subscribe', { 'channel' : 'test' });
I've tried using client.of("test", callback)
, client.emit("subscribe", jsonArray)
where the array has the channel, but I always end up with a Creating frame error
.
Upvotes: 1
Views: 1448
Reputation: 372
Socket.io servers require authentication. This is done by sending a post to /socket.io/1/ at the server and reading the response which will look like this:
srGlg8x2YschJzuGVeeq:60:60:websocket,htmlfile,xhr-polling,jsonp-polling
The string before the first ":" is the key. Now if you are connecting to the server via a websocket the address will be:
ws://(Your socket.io server)/socket.io/1/websocket/(The key)
More information on the socket.io protocol: github.com/LearnBoost/socket.io-spec
ps. I don't know anything about android programming but I'm just explaining the socket.io protocol
Upvotes: 1