IHttpConnectionOptions interface
Options provided to the 'withUrl' method on HubConnectionBuilder to configure options for the HTTP-based transports.
Properties
Event |
A constructor that can be used to create an EventSource. |
headers | MessageHeaders containing custom headers to be sent with every HTTP request. Note, setting headers in the browser will not work for WebSockets or the ServerSentEvents stream. |
http |
An HttpClient that will be used to make HTTP requests. |
logger | Configures the logger used for logging. Provide an ILogger instance, and log messages will be logged via that instance. Alternatively, provide a value from the LogLevel enumeration and a default logger which logs to the Console will be configured to log messages of the specified level (or higher). |
log |
A boolean indicating if message content should be logged. Message content can contain sensitive user data, so this is disabled by default. |
skip |
A boolean indicating if negotiation should be skipped. Negotiation can only be skipped when the transport property is set to 'HttpTransportType.WebSockets'. |
timeout | Default value is 100,000 milliseconds. Timeout to apply to Http requests. This will not apply to Long Polling poll requests, EventSource, or WebSockets. |
transport | An HttpTransportType value specifying the transport to use for the connection. |
Web |
A constructor that can be used to create a WebSocket. |
with |
Default value is 'true'. This controls whether credentials such as cookies are sent in cross-site requests. Cookies are used by many load-balancers for sticky sessions which is required when your app is deployed with multiple servers. |
Methods
access |
A function that provides an access token required for HTTP Bearer authentication. |
Property Details
EventSource
A constructor that can be used to create an EventSource.
EventSource?: EventSourceConstructor
Property Value
EventSourceConstructor
headers
MessageHeaders containing custom headers to be sent with every HTTP request. Note, setting headers in the browser will not work for WebSockets or the ServerSentEvents stream.
headers?: MessageHeaders
Property Value
httpClient
logger
Configures the logger used for logging. Provide an ILogger instance, and log messages will be logged via that instance. Alternatively, provide a value from the LogLevel enumeration and a default logger which logs to the Console will be configured to log messages of the specified level (or higher).
logger?: ILogger | LogLevel
Property Value
logMessageContent
A boolean indicating if message content should be logged. Message content can contain sensitive user data, so this is disabled by default.
logMessageContent?: boolean
Property Value
boolean
skipNegotiation
A boolean indicating if negotiation should be skipped. Negotiation can only be skipped when the transport property is set to 'HttpTransportType.WebSockets'.
skipNegotiation?: boolean
Property Value
boolean
timeout
Default value is 100,000 milliseconds. Timeout to apply to Http requests. This will not apply to Long Polling poll requests, EventSource, or WebSockets.
timeout?: number
Property Value
number
transport
An HttpTransportType value specifying the transport to use for the connection.
transport?: HttpTransportType | ITransport
Property Value
WebSocket
A constructor that can be used to create a WebSocket.
WebSocket?: WebSocketConstructor
Property Value
WebSocketConstructor
withCredentials
Default value is 'true'. This controls whether credentials such as cookies are sent in cross-site requests. Cookies are used by many load-balancers for sticky sessions which is required when your app is deployed with multiple servers.
withCredentials?: boolean
Property Value
boolean
Method Details
accessTokenFactory()
A function that provides an access token required for HTTP Bearer authentication.
function accessTokenFactory(): string | Promise<string>
Returns
string | Promise<string>
A string containing the access token, or a Promise that resolves to a string containing the access token.