Support for multiple connections?

Jul 13, 2012 at 6:21 PM
Edited Jul 13, 2012 at 6:35 PM

This is want I would like to do:

1. Server application Starts the SuperWebSocket listens on port 1234

2. Browser connects the server application via Websocktes on port 1234.

3. Server accepts the new connection and stops listening for new connections.  At this point a new instanced of the Server application is created (repeat steps 1-3).

The issue I am having is with step 3.  When I call WebSocketServer.Stop(), it also closes all of the WebSocketSession objects.  Is there a way to keep the session objects open while a new instance of the program is created which listens on the same port?


Jul 14, 2012 at 2:39 PM

OH, I don't know how did you get this conclusion.

There two PerformanceTest projects (server and client) included in the source code. These two projects are used for testing performance when there are thousands of clients are connected and communicating non-stop with the single server instance.


Jul 17, 2012 at 12:03 AM

Take that same project and modify it so that it stops the server from accepting new connections.  The only way that I know how to do that is to call the stop() method on the server object.  Doing so will also close all of the client sessions.

Is there a way to stop the server from listening without it closing all of the client sessions?


Jul 17, 2012 at 3:41 AM

I planed it in 1.6 to support hot upgrade.

For now,  can you think about other ways?

Jul 17, 2012 at 5:23 AM

The only way that I can think to work around this is to have a data file which indicates a range of ports for the client to connect to and for the server to listen on.  After a client then connects to the server, the server then denies any new connections and then forks the new process.  The new process will then attempt to listen on the ports in the range indicated in the data file.

The issue with this is it is much slower to connect to the server because the client has to try each port in the range until it is able to connect to a vacant server instance.  And another issue is that this method requires that I have multiple ports opened on the server.


Jul 17, 2012 at 5:25 AM

You can do it by connection filter: