TsgcWebSocketServer › Properties › QueueOptions
Serialises outbound messages through an internal per-connection queue to prevent contention between threads.
property QueueOptions: TsgcWSQueueServer_Options read FQueueOptions write SetQueueOptions;
Text=qmNone, Binary=qmNone, Ping=qmNone
When enabled, messages are placed in an internal queue and sent in the context of the connection thread instead of the caller's thread — this removes the locking needed when several threads write to the same connection simultaneously. Each message type (Text, Binary, Ping) can be assigned an independent priority level: qmNone skips the queue (default), qmLevel1 is processed first, then qmLevel2 and finally qmLevel3. For example, setting Text and Binary to qmLevel2 and Ping to qmLevel1 guarantees pings are delivered before ordinary traffic. QueueOptions is not supported when IOHandlerOptions is set to iohIOCP.
oServer := TsgcWebSocketServer.Create(nil);
oServer.QueueOptions.Text := qmLevel2;
oServer.QueueOptions.Binary := qmLevel2;
oServer.QueueOptions.Ping := qmLevel1;
oServer.Active := true;