long-term credential 메커니즘은 클라이언트와 서버 간에 공유되는 사용자 이름과 비밀번호 형태의 long-term credential에 의존합니다. 이 credential은 사용자에 대해 프로비저닝되며 사용자가 시스템의 구독자가 아니게 되거나 변경될 때까지 유효한 것으로 가정되므로 long-term으로 간주됩니다.
sgcWebSockets STUN 클라이언트에서 다음 코드를 사용하여 Long-term 자격 증명을 구성할 수 있습니다.
oSTUN := TsgcSTUNClient.Create(nil);
oSTUN.Host := 'stun.sgcwebsockets.com';
oSTUN.Port := 3478;
oSTUN.STUNOptions.Authentication.Credentials := stauLongTermCredential;
oSTUN.STUNOptions.Authentication.Username := 'user_name';
oSTUN.STUNOptions.Authentication.Password := 'secret';
oSTUN.SendRequest;
서버가 장기 자격 증명을 요구하고 클라이언트가 보낸 자격 증명이 잘못된 경우, 클라이언트는 OnSTUNResponseError 이벤트에서 401 Unauthorized 오류를 응답으로 받습니다.