TsgcWebSocketClient › 속성 › Options
핸드셰이크 헤더를 사용자 정의하고 프래그먼트화 및 UTF-8 검증과 같은 클라이언트 동작을 세밀하게 조정합니다.
__property TsgcWSOptionsClient * Options;
FragmentedMessages=frgOnlyBuffer, RaiseDisconnectExceptions=True, ValidateUTF8=False, CleanDisconnect=False, WaitForConnect=False
핸드셰이크 및 런타임 설정을 노출합니다: Parameters(추가 GET 매개변수), Origin(사용자 정의 Origin 헤더) 및 조각이 버퍼링되는지(frgOnlyBuffer), 개별적으로 보고되는지(frgOnlyFragmented) 또는 둘 다(frgAll)를 선택하는 FragmentedMessages입니다. RaiseDisconnectExceptions는 프로토콜 오류 연결 해제 시 예외를 발생시키고, ValidateUTF8은 텍스트 프레임의 UTF-8 준수를 검증하며, CleanDisconnect는 TCP 세션을 끊기 전에 close 프레임을 보냅니다.
WaitForConnect controls when the synchronous Connect call returns. By default (False) Connect returns as soon as the WebSocket transport is connected, which can be before the OnConnect event has fired. When set to True, Connect returns only after the OnConnect event has run, so for a sub-protocol that establishes a session on connect (for example the sgc protocol, which assigns a session in its OnConnect) the connection is fully ready as soon as Connect returns. This avoids a connect-readiness race on fast reconnects, where code that inspects the connection immediately after Connect could run before the sub-protocol OnConnect had fired. It applies when NotifyEvents is neNoSync, where events run inline on the read thread. With neAsynchronous the OnConnect event is queued to the main thread and cannot be awaited inside Connect, so use the OnConnect event to detect readiness in that case.
oClient = new TsgcWebSocketClient();
oClient->URL = "wss://www.esegece.com:2053";
oClient->Options->Parameters = "/ws/";
oClient->Options->ValidateUTF8 = true;
oClient->Options->CleanDisconnect = true;
oClient->Options->WaitForConnect = true;
oClient->Active = true;