This project is read-only.

opened event not being fired

Apr 18, 2012 at 4:50 AM

hello, I was trying the EchoServer example from SuperSocket and it works just fine when I connect via telnet, but whenever I try to connect using WebSocket4Net the Opened event just won't fire and no exception is thrown after the invocation of the Open method, is there anything I could be doing wrong?

I tried the default "EchoServer" example and the code I've been trying to use to connect follows below:

static void Main(string[] args)
{
    WebSocket websocket = new WebSocket("ws://127.0.0.1:911/", "basic", WebSocketVersion.DraftHybi00);
    websocket.Opened += new EventHandler(websocket_Opened);

    websocket.Open();

    while (true)
    {
        var line = Console.ReadLine();

        if (line.Equals("Q", StringComparison.OrdinalIgnoreCase))
        {
            websocket.Close();
            break;
        }
    }
}

static void websocket_Opened(object sender, EventArgs e)
{
    Console.WriteLine("handshake succeded");
}

thanks in advance!

Apr 18, 2012 at 5:03 AM

Oh, SuperSocket is not a WebSocket server.

You should try SuperWebSocket:

http://superwebsocket.codeplex.com

Apr 18, 2012 at 5:12 AM

damn now I'm feeling ashamed, thanks a lot! gonna try that one, didn't notice the difference before, thanks again!