Date: Thu, 28 Mar 2024 10:57:59 +0100 (CET) Message-ID: <100927862.47057.1711619879475@docs.flashphoner.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_47056_1646949874.1711619879475" ------=_Part_47056_1646949874.1711619879475 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Since build 2.6.8 it is possible= to add custom HTTP headers while establishing Websocket connection to WCS = server. To do this, use the following function
FPWCSApi2Session c= onnectWithHeaders:(NSDictionary<NSString *, NSString *> *) headers=20
Suppose that Websocket traffic proxying with user authentication is co= nfigured on the server using nginx. In this case, user credentials should b= e passed in Websocket URL
wss://login:passw= ord@test.flashphoner.com/wss=20
In this case, Authorization HTTP h= eader should be formed from Websocket URL and should be sent while connecti= ng to the server as follows:
NSURL* nsU= RL =3D [NSURL URLWithString:_urlInput.text]; if (nsURL.user && nsURL.password) { NSString* auth =3D [NSString stringWithFormat:@"%@:%@", nsURL.u= ser, nsURL.password]; NSData *authData =3D [auth dataUsingEncoding:NSUTF8StringEncodi= ng]; NSString *authBase64 =3D [NSString stringWithFormat:@"Basic %@"= , [authData base64EncodedStringWithOptions:kNilOptions]]; NSDictionary *headers =3D [[NSDictionary alloc] initWithObjects= AndKeys: authBase64, @"Authorization", nil]; [_session connectWithHeaders: headers]; } else { [_session connect]; }=20