08-14-2026, 08:01 AM
(08-13-2026, 05:14 AM)hamstring Wrote: I think that the reason for getting two threads created might be that the http connection and websocket context were not separated.
I didn't see all of your code, but my guess is you are getting 2 threads for 2 separate TCP connections - one for the HTTP client that receives the HTML, and one for the WebSocket.
(08-13-2026, 05:14 AM)hamstring Wrote: My question now is whether FWebSocketServer.OnExecute := DoServerExecute; is not required anymore or what should it be used for?
Your DoServerExecute() is useless and should be removed. TWebSocketServer overrides DoExecute() and does not call inherited, so the OnExecute event is never triggered.
(08-13-2026, 05:14 AM)hamstring Wrote: What is the difference between FWebSocketServer.OnExecute and FWebSocketServer.OnWebSocketExecute ?
OnExecute is triggered by the inherited DoExecute() on each iteration of the thread's loop. It is meant to handle any processing needed for the TCP connection as a whole for the current iteration. But since DoExecute() is overriden, this doesn't happen.
OnWebSocketExecute is triggered by the overriden DoExecute() on each iteration, after the WebSocket handshake has been completed. It is meant to handle any processing needed for just the WebSocket on the current iteration.

