HubConnectionBuilder.d.ts 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { HubConnection } from "./HubConnection";
  2. import { IHttpConnectionOptions } from "./IHttpConnectionOptions";
  3. import { IHubProtocol } from "./IHubProtocol";
  4. import { ILogger, LogLevel } from "./ILogger";
  5. import { HttpTransportType } from "./ITransport";
  6. /** A builder for configuring {@link @aspnet/signalr.HubConnection} instances. */
  7. export declare class HubConnectionBuilder {
  8. /** Configures console logging for the {@link @aspnet/signalr.HubConnection}.
  9. *
  10. * @param {LogLevel} logLevel The minimum level of messages to log. Anything at this level, or a more severe level, will be logged.
  11. * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining.
  12. */
  13. configureLogging(logLevel: LogLevel): HubConnectionBuilder;
  14. /** Configures custom logging for the {@link @aspnet/signalr.HubConnection}.
  15. *
  16. * @param {ILogger} logger An object implementing the {@link @aspnet/signalr.ILogger} interface, which will be used to write all log messages.
  17. * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining.
  18. */
  19. configureLogging(logger: ILogger): HubConnectionBuilder;
  20. /** Configures custom logging for the {@link @aspnet/signalr.HubConnection}.
  21. *
  22. * @param {LogLevel | ILogger} logging An object implementing the {@link @aspnet/signalr.ILogger} interface or {@link @aspnet/signalr.LogLevel}.
  23. * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining.
  24. */
  25. configureLogging(logging: LogLevel | ILogger): HubConnectionBuilder;
  26. /** Configures the {@link @aspnet/signalr.HubConnection} to use HTTP-based transports to connect to the specified URL.
  27. *
  28. * The transport will be selected automatically based on what the server and client support.
  29. *
  30. * @param {string} url The URL the connection will use.
  31. * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining.
  32. */
  33. withUrl(url: string): HubConnectionBuilder;
  34. /** Configures the {@link @aspnet/signalr.HubConnection} to use the specified HTTP-based transport to connect to the specified URL.
  35. *
  36. * @param {string} url The URL the connection will use.
  37. * @param {HttpTransportType} transportType The specific transport to use.
  38. * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining.
  39. */
  40. withUrl(url: string, transportType: HttpTransportType): HubConnectionBuilder;
  41. /** Configures the {@link @aspnet/signalr.HubConnection} to use HTTP-based transports to connect to the specified URL.
  42. *
  43. * @param {string} url The URL the connection will use.
  44. * @param {IHttpConnectionOptions} options An options object used to configure the connection.
  45. * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining.
  46. */
  47. withUrl(url: string, options: IHttpConnectionOptions): HubConnectionBuilder;
  48. /** Configures the {@link @aspnet/signalr.HubConnection} to use the specified Hub Protocol.
  49. *
  50. * @param {IHubProtocol} protocol The {@link @aspnet/signalr.IHubProtocol} implementation to use.
  51. */
  52. withHubProtocol(protocol: IHubProtocol): HubConnectionBuilder;
  53. /** Creates a {@link @aspnet/signalr.HubConnection} from the configuration options specified in this builder.
  54. *
  55. * @returns {HubConnection} The configured {@link @aspnet/signalr.HubConnection}.
  56. */
  57. build(): HubConnection;
  58. }