This project is read-only.

connect, disconnect and ...no connect again

Jun 20, 2012 at 4:43 PM
Edited Jun 20, 2012 at 4:44 PM

Hello, guys!

I wrote a simplest helloworld-style client and server application using SuperWebSocket and WebSocket4Net libraries.

So when I connect, then disconnect Websocket client from server and trying to connect again, client is always in state "Connecting" instead of "Connected".

BTW data flow is ok and I am able to disconnect and reconnect as many times as possible.

And there is a side bug of this: "Opened" event fired only first time I connected  :(

Jun 20, 2012 at 4:47 PM

Please don't use the closed websocket instance, create a new instance to connect.

Jun 20, 2012 at 4:50 PM

Ok, thanks for immediate answer!

Jul 17, 2012 at 4:34 AM

The latest websocket4net in source code has supported reconnect directly, you needn't create a new instance now.

Jul 17, 2012 at 6:21 AM

Thank you!

Dec 28, 2012 at 12:15 PM

Hello!
What is the good way to do the reconnect ? This code cause problem :( Thanks for help

if (websocket.State == WebSocketState.Open)
                            {
                                websocket.Send(json);
                            }
                            else
                            {
                                websocket.Open();
                                websocket.Send(json);
                            }