ConnectionRequest Event

Fires when a WebSocket connection is requested.

Syntax

public event OnConnectionRequestHandler OnConnectionRequest;

public delegate void OnConnectionRequestHandler(object sender, AzurerelayreceiverConnectionRequestEventArgs e);

public class AzurerelayreceiverConnectionRequestEventArgs : EventArgs {
  public bool Accept { get; set; }
  public string RendezvousAddress { get; }
  public string Id { get; }
  public string ConnectHeaders { get; }
  public string SubProtocols { get; }
  public string Extensions { get; }
  public string Host { get; }
  public string RemoteAddress { get; }
  public int RemotePort { get; }
  public int StatusCode { get; set; }
  public string StatusDescription { get; set; }
}
Public Event OnConnectionRequest As OnConnectionRequestHandler

Public Delegate Sub OnConnectionRequestHandler(sender As Object, e As AzurerelayreceiverConnectionRequestEventArgs)

Public Class AzurerelayreceiverConnectionRequestEventArgs Inherits EventArgs
  Public Property Accept As Boolean
  Public ReadOnly Property RendezvousAddress As String
  Public ReadOnly Property Id As String
  Public ReadOnly Property ConnectHeaders As String
  Public ReadOnly Property SubProtocols As String
  Public ReadOnly Property Extensions As String
  Public ReadOnly Property Host As String
  Public ReadOnly Property RemoteAddress As String
  Public ReadOnly Property RemotePort As Integer
  Public Property StatusCode As Integer
  Public Property StatusDescription As String
End Class

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 .NET Edition - Version 20.0 [Build 8155]