TsgcWebSocketServerProperties › QueueOptions

QueueOptions Property

Serialises outbound messages through an internal per-connection queue to prevent contention between threads.

Syntax

public TsgcWSQueueServer_Options QueueOptions { get; set; }

Default Value

Text=qmNone, Binary=qmNone, Ping=qmNone

Remarks

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.

Example


oServer = new TsgcWebSocketServer();
oServer.QueueOptions.Text = TwsQueueMode.qmLevel2;
oServer.QueueOptions.Binary = TwsQueueMode.qmLevel2;
oServer.QueueOptions.Ping = TwsQueueMode.qmLevel1;
oServer.Active = true;

Back to Properties