1 | // Copyright (c) .NET Foundation. All rights reserved.
|
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
3 |
|
4 | import { HttpClient } from "./HttpClient";
|
5 | import { ILogger, LogLevel } from "./ILogger";
|
6 | import { HttpTransportType, ITransport } from "./ITransport";
|
7 | import { EventSourceConstructor, WebSocketConstructor } from "./Polyfills";
|
8 |
|
9 | /** Options provided to the 'withUrl' method on {@link @microsoft/signalr.HubConnectionBuilder} to configure options for the HTTP-based transports. */
|
10 | export interface IHttpConnectionOptions {
|
11 | /** An {@link @microsoft/signalr.HttpClient} that will be used to make HTTP requests. */
|
12 | httpClient?: HttpClient;
|
13 |
|
14 | /** An {@link @microsoft/signalr.HttpTransportType} value specifying the transport to use for the connection. */
|
15 | transport?: HttpTransportType | ITransport;
|
16 |
|
17 | /** Configures the logger used for logging.
|
18 | *
|
19 | * Provide an {@link @microsoft/signalr.ILogger} instance, and log messages will be logged via that instance. Alternatively, provide a value from
|
20 | * the {@link @microsoft/signalr.LogLevel} enumeration and a default logger which logs to the Console will be configured to log messages of the specified
|
21 | * level (or higher).
|
22 | */
|
23 | logger?: ILogger | LogLevel;
|
24 |
|
25 | /** A function that provides an access token required for HTTP Bearer authentication.
|
26 | *
|
27 | * @returns {string | Promise<string>} A string containing the access token, or a Promise that resolves to a string containing the access token.
|
28 | */
|
29 | accessTokenFactory?(): string | Promise<string>;
|
30 |
|
31 | /** A boolean indicating if message content should be logged.
|
32 | *
|
33 | * Message content can contain sensitive user data, so this is disabled by default.
|
34 | */
|
35 | logMessageContent?: boolean;
|
36 |
|
37 | /** A boolean indicating if negotiation should be skipped.
|
38 | *
|
39 | * Negotiation can only be skipped when the {@link @microsoft/signalr.IHttpConnectionOptions.transport} property is set to 'HttpTransportType.WebSockets'.
|
40 | */
|
41 | skipNegotiation?: boolean;
|
42 |
|
43 | // Used for unit testing and code spelunkers
|
44 | /** A constructor that can be used to create a WebSocket.
|
45 | *
|
46 | * @internal
|
47 | */
|
48 | WebSocket?: WebSocketConstructor;
|
49 |
|
50 | // Used for unit testing and code spelunkers
|
51 | /** A constructor that can be used to create an EventSource.
|
52 | *
|
53 | * @internal
|
54 | */
|
55 | EventSource?: EventSourceConstructor;
|
56 | }
|