statianzo / Fleck

C# Websocket Implementation
MIT License
2.28k stars 583 forks source link

How to let the session close at end of the prosess by OnMessage, disable. #330

Open digiponta opened 2 years ago

digiponta commented 2 years ago

Hi, Thank you for your wonderful library.

Now, I would like to know the correct specification. Is it a specification that the socket session will be closed when the process starting with Start -> OnMessage ends? Looking at the code fragment below, it seems so. Is there a way to keep-alive the socket session from OnMessage?

            connection = new WebSocketConnection(
                clientSocket,
                _config,
                bytes => RequestParser.Parse(bytes, _scheme),
                r => HandlerFactory.BuildHandler(r,
                                                 s => connection.OnMessage(s),
                                                 connection.Close,