TsgcWebSocketHTTPServer属性 › QueueOptions

QueueOptions 属性

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

语法

property QueueOptions: TsgcWSQueueServer_Options read FQueueOptions write SetQueueOptions;

默认值

Text=qmNoneBinary=qmNonePing=qmNone

备注

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

示例


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

返回属性