TsgcWebSocketHTTPServer › 属性 › SessionTimeOut
HTTP 会话被视为过期并可被移除的空闲超时时间(毫秒)。
property SessionTimeOut: Integer read GetSessionTimeOut write SetSessionTimeOut;
0(继承 Indy 默认值)
一旦启用 SessionState,SessionTimeOut 定义会话在被标记为无效并最终由内部会话清理线程移除之前,可以保持空闲的时长(毫秒)。携带已过期会话 id 的请求将触发 OnInvalidSession,以便您做出反应(将用户登出、颁发新会话等)。请选择在安全性(短会话)和用户体验(长会话)之间取得平衡的超时时间。
oServer := TsgcWebSocketHTTPServer.Create(nil);
oServer.SessionState := true;
oServer.SessionTimeOut := 600000; // 10 minutes
oServer.Active := true;