Share via


HybridConnectionListener Class

Definition

Provides a listener for accepting HybridConnections from remote clients.

public class HybridConnectionListener : Microsoft.Azure.Relay.IConnectionStatus
type HybridConnectionListener = class
    interface IConnectionStatus
Public Class HybridConnectionListener
Implements IConnectionStatus
Inheritance
HybridConnectionListener
Implements

Constructors

HybridConnectionListener(String, String)

Creates a new instance of HybridConnectionListener from a connection string and the specified HybridConection path. Use this overload only when the connection string does not use the EntityPath property, and AAD is not the method of authentication.

HybridConnectionListener(String)

Creates a new instance of HybridConnectionListener using the specified connection string. Use this overload only when AAD is not the method of authentication.

HybridConnectionListener(Uri, TokenProvider)

Create a new HybridConnectionListener instance for accepting HybridConnections.

Properties

AcceptHandler

Allows installing a custom handler which can inspect request headers, control response headers, decide whether to accept or reject a web-socket upgrade request, and control the status code/description if rejecting. The AcceptHandler should return true to accept a client request or false to reject.

Address

Gets the address on which to listen for HybridConnections. This address should be of the format "sb://contoso.servicebus.windows.net/yourhybridconnection".

ClientWebSocketFactory

Custom ClientWebSocket Implementation.

IsOnline

Gets a value that determines whether the connection is online.

KeepAliveInterval

Websocket's keep-alive interval.

LastError

Retrieves the last error encountered when trying to reestablish the connection from the offline state.

Proxy

Gets or sets proxy information for connecting to ServiceBus.

RequestHandler

Installs a handler for Hybrid Http Requests.

TokenProvider

Gets the TokenProvider for authenticating this HybridConnection listener.

TrackingContext

Gets the TrackingContext for this listener.

UseBuiltInClientWebSocket

Controls whether the ClientWebSocket from .NET Core or a custom implementation is used. If a custom ClientWebSocketFactory is configured then this property is ignored.

Methods

AcceptConnectionAsync()

Accepts a new HybridConnection which was initiated by a remote client and returns the Stream.

CloseAsync()

Closes the HybridConnectionListener using the default timeout. Unless specified in the connection string the default is 1 minute.

CloseAsync(CancellationToken)

Closes the HybridConnectionListener using the provided CancellationToken.

CloseAsync(TimeSpan)

Closes the HybridConnectionListener using the provided timeout.

GetRuntimeInformationAsync()

Gets the HybridConnectionRuntimeInformation for this HybridConnection entity using the default timeout. Unless specified in the connection string the default is 1 minute.

GetRuntimeInformationAsync(CancellationToken)

Gets the HybridConnectionRuntimeInformation for this HybridConnection entity using the provided CancellationToken.

OpenAsync()

Opens the HybridConnectionListener and registers it as a listener in ServiceBus. Unless specified in the connection string the default is 1 minute.

OpenAsync(CancellationToken)

Opens the HybridConnectionListener and registers it as a listener in ServiceBus.

OpenAsync(TimeSpan)

Opens the HybridConnectionListener and registers it as a listener in ServiceBus.

ToString()

Returns a string that represents the current object. Includes a TrackingId for end to end correlation.

Events

Connecting

Raised when the Listener is attempting to reconnect with ServiceBus after a connection loss. Check LastError for more details.

Offline

Raised when the Listener will no longer be attempting to reconnect with ServiceBus. Reasons include user-initiated listener close or the HybridConnection management object was deleted (e.g. via portal or ARM). Check LastError for more details when this event is raised unexpectedly.

Online

Raised when the Listener has successfully connected or reconnected with ServiceBus. LastError will be null at this point.

Applies to