error initialization handshake with http://localhost:xxxx


I get above mentioned error while I run my client code.here is the part of my code and attached the server code.
         socket = new Client("http://localhost:1000/");
        socket.Opened += SocketOpened;
        socket.Message += SocketMessage;
        socket.SocketConnectionClosed += SocketConnectionClosed;
        socket.Error += SocketError;
        socket.On("connection", (fn) =>
            // emit Json Serializable object, anonymous types, or strings
            Part newPart = new Part() {message =msg };
          socket.Emit("message_to_server", newPart);

file attachments


jstott wrote Jun 10, 2014 at 2:25 AM

You have the server setup on port 1337, and the client connecting to port 1000 ?

dushancst wrote Jun 11, 2014 at 2:21 AM

I changed the port in client to 1337.but still the error pops up.

wjdavis5 wrote Jul 21, 2014 at 5:16 PM

I figured this out - Originally I was using this:
socket = new Client("");
But I updated it to this - which I found whilst running Fiddler.

I figured this out by digging into the source (Client.cs) and referencing this line:
value = client.DownloadString(string.Format("{0}://{1}:{2}/socket.io/1/{3}", uri.Scheme, uri.Host, uri.Port, uri.Query)); // #5 tkiley: The uri.Query is available in socket.io's handshakeData object during authorization
                    // 13052140081337757257:15:25:websocket,htmlfile,xhr-polling,jsonp-polling
change my code to
socket = new Client("");