onConnectionRequest (event)

Fires when a WebSocket connection is requested.

Syntax

- (void)onConnectionRequest:(int*)accept :(NSString*)rendezvousAddress :(NSString*)id :(NSString*)connectHeaders :(NSString*)subProtocols :(NSString*)extensions :(NSString*)host :(NSString*)remoteAddress :(int)remotePort :(int*)statusCode :(NSString**)statusDescription;
func onConnectionRequest(_ accept: inout Int32, _ rendezvousAddress: String, _ id: String, _ connectHeaders: String, _ subProtocols: String, _ extensions: String, _ host: String, _ remoteAddress: String, _ remotePort: Int32, _ statusCode: inout Int32, _ statusDescription: inout NSString?)

Remarks

This event fires when a client requests a connection. The parameters of this event may be used to determine whether to accept or reject the connection.

To accept a connection set Accept to True (default). To reject a connection set Accept to False and set StatusCode and StatusDescription.

Accept defines whether the connection request is accepted or rejected. The default value is True. Set this to False to reject the connection.

RendezvousAddress holds the rendezvous URL to which the connection specific websocket connection will be made. This is informational only.

Id holds the Id of the connection. If an Id was specified by the client it is present here, otherwise the Azure Relay Service generates a value. For instance: b3ac97ea-d0f0-4286-bf1d-d493a4a22c27_G23_G22.

ConnectHeaders contains a JSON object with the HTTP headers that have been supplied by the sender to the Azure Relay service. For instance:

"connectHeaders": {
	"Sec-WebSocket-Key": "wIdDlRBg\/J\/Hx12q6iFdUQ==",
	"Sec-WebSocket-Version": "13",
	"Origin": "null",
	"Connection": "Upgrade",
	"Upgrade": "websocket",
	"Accept-Encoding": "gzip, deflate",
	"Host": "nstest.servicebus.windows.net",
	"User-Agent": "IPWorks HTTP Component - www.nsoftware.com"
}

SubProtocols holds the subprotocols (application-level protocols layered over the WebSocket Protocol) sent by the client in the initial WebSocket connection request.

Extensions holds the WebSocket extensions sent by the client in the initial WebSocket connection request.

Host is the Host header value of the connected client.

RemoteAddress is the IP address of the connecting client.

RemotePort is the port used by the connecting client.

StatusCode is a 3 digit HTTP status code used when Accept is set to False. Set this to any 3 digit HTTP status code when rejecting a connection. For instance: 404.

StatusDescription should be set to the text description corresponding to the StatusCode value when rejecting a connection. For instance: Not Found.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks MQ 2020 iOS Edition - Version 20.0 [Build 8155]