TsgcWebSocketServer_HTTPAPIProperties › QueueOptions

QueueOptions 属性

通过内部每连接队列序列化出站消息,以防止线程间的竞争。

语法

property QueueOptions: TsgcWSQueueServer_Options read FQueueOptions write SetQueueOptions;

默认值

Text=qmNoneBinary=qmNonePing=qmNone

备注

启用后,消息被放入内部队列,并在连接线程的上下文中发送,而非在调用方线程中发送。这消除了多个线程同时向同一连接写入时所需的锁定。每种消息类型(TextBinaryPing)可以分配独立的优先级别:qmNone 跳过队列(默认),qmLevel1 最先处理,然后是 qmLevel2,最后是 qmLevel3。例如,将 TextBinary 设为 qmLevel2,将 Ping 设为 qmLevel1,可保证 ping 先于普通流量传递。

示例


oServer := TsgcWebSocketServer_HTTPAPI.Create(nil);
oServer.QueueOptions.Text := qmLevel2;
oServer.QueueOptions.Binary := qmLevel2;
oServer.QueueOptions.Ping := qmLevel1;
oServer.Active := true;

返回属性