userver.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { AttachOptions, BaseServer } from "./server";
  2. export interface uOptions {
  3. /**
  4. * What permessage-deflate compression to use. uWS.DISABLED, uWS.SHARED_COMPRESSOR or any of the uWS.DEDICATED_COMPRESSOR_xxxKB.
  5. * @default uWS.DISABLED
  6. */
  7. compression?: number;
  8. /**
  9. * Maximum amount of seconds that may pass without sending or getting a message. Connection is closed if this timeout passes. Resolution (granularity) for timeouts are typically 4 seconds, rounded to closest. Disable by using 0.
  10. * @default 120
  11. */
  12. idleTimeout?: number;
  13. /**
  14. * Maximum length of allowed backpressure per socket when publishing or sending messages. Slow receivers with too high backpressure will be skipped until they catch up or timeout.
  15. * @default 1024 * 1024
  16. */
  17. maxBackpressure?: number;
  18. }
  19. export declare class uServer extends BaseServer {
  20. protected init(): void;
  21. protected cleanup(): void;
  22. /**
  23. * Prepares a request by processing the query string.
  24. *
  25. * @api private
  26. */
  27. private prepare;
  28. protected createTransport(transportName: any, req: any): any;
  29. /**
  30. * Attach the engine to a µWebSockets.js server
  31. * @param app
  32. * @param options
  33. */
  34. attach(app: any, options?: AttachOptions & uOptions): void;
  35. _applyMiddlewares(req: any, res: any, callback: (err?: any) => void): void;
  36. private handleRequest;
  37. private handleUpgrade;
  38. private abortRequest;
  39. }