Disconnecing straight after message received

Jul 16, 2013 at 11:04 PM
I'm in the process of writing a Windows Phone 8 application that involves communicating with a Socket.IO API. I'm at the point of writing a Socket.IO library on top of WebSocket4Net, but I'm having a strange error.

I do the Socket.IO handshake over HTTP and get the session ID. I then attempt to connect to the websocket using WebSocket4Net. I've added listeners to the Opened, Error, MessageReceived, DataReceived and Closed events. Upon calling the Open() method, the following happens:
Opening transport to ws://[redacted]:443/socket.io/1/websocket/fRBEkxPSezu-6n-UMQyp
Message received: 1::
Transport closed
A few things to note with this:
  • I'm aware that I'm using ws rather than wss over port 443, that's just the way this API is set up
  • 1:: is the connect message from Socket.IO
  • The Opened event is never called, but as you can see, a message is received
  • The connection closes as soon as the message has been received
Finally, I'm constructing the WebSocket client as follows:
wsClient = new WebSocket(requestUri, wsScheme, string.Empty, null, "App Windows Phone", null, wsVersion);
Where wsScheme is "ws" and wsVersion is WebSocketVersion.Rfc6455.

Can anybody see what I'm doing wrong?
Jul 17, 2013 at 5:12 PM
Aha, I've worked it out. For anyone else having the same problem, if the subprotocol isn't on this list, then it should be blank.
Coordinator
Jul 18, 2013 at 2:58 AM
Sorry for my late response. I am glad to see you have fixed the issue.