IHttpConnectionOptions.d.ts 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { HttpClient } from "./HttpClient";
  2. import { MessageHeaders } from "./IHubProtocol";
  3. import { ILogger, LogLevel } from "./ILogger";
  4. import { HttpTransportType, ITransport } from "./ITransport";
  5. /** Options provided to the 'withUrl' method on {@link @microsoft/signalr.HubConnectionBuilder} to configure options for the HTTP-based transports. */
  6. export interface IHttpConnectionOptions {
  7. /** {@link @microsoft/signalr.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. */
  8. headers?: MessageHeaders;
  9. /** An {@link @microsoft/signalr.HttpClient} that will be used to make HTTP requests. */
  10. httpClient?: HttpClient;
  11. /** An {@link @microsoft/signalr.HttpTransportType} value specifying the transport to use for the connection. */
  12. transport?: HttpTransportType | ITransport;
  13. /** Configures the logger used for logging.
  14. *
  15. * Provide an {@link @microsoft/signalr.ILogger} instance, and log messages will be logged via that instance. Alternatively, provide a value from
  16. * the {@link @microsoft/signalr.LogLevel} enumeration and a default logger which logs to the Console will be configured to log messages of the specified
  17. * level (or higher).
  18. */
  19. logger?: ILogger | LogLevel;
  20. /** A function that provides an access token required for HTTP Bearer authentication.
  21. *
  22. * @returns {string | Promise<string>} A string containing the access token, or a Promise that resolves to a string containing the access token.
  23. */
  24. accessTokenFactory?(): string | Promise<string>;
  25. /** A boolean indicating if message content should be logged.
  26. *
  27. * Message content can contain sensitive user data, so this is disabled by default.
  28. */
  29. logMessageContent?: boolean;
  30. /** A boolean indicating if negotiation should be skipped.
  31. *
  32. * Negotiation can only be skipped when the {@link @microsoft/signalr.IHttpConnectionOptions.transport} property is set to 'HttpTransportType.WebSockets'.
  33. */
  34. skipNegotiation?: boolean;
  35. /**
  36. * Default value is 'true'.
  37. * This controls whether credentials such as cookies are sent in cross-site requests.
  38. *
  39. * Cookies are used by many load-balancers for sticky sessions which is required when your app is deployed with multiple servers.
  40. */
  41. withCredentials?: boolean;
  42. /**
  43. * Default value is 100,000 milliseconds.
  44. * Timeout to apply to Http requests.
  45. *
  46. * This will not apply to Long Polling poll requests, EventSource, or WebSockets.
  47. */
  48. timeout?: number;
  49. }