userver.d.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { AttachOptions, BaseServer } from "./server";
  2. import { EngineRequest } from "./transport";
  3. export interface uOptions {
  4. /**
  5. * What permessage-deflate compression to use. uWS.DISABLED, uWS.SHARED_COMPRESSOR or any of the uWS.DEDICATED_COMPRESSOR_xxxKB.
  6. * @default uWS.DISABLED
  7. */
  8. compression?: number;
  9. /**
  10. * 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.
  11. * @default 120
  12. */
  13. idleTimeout?: number;
  14. /**
  15. * 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.
  16. * @default 1024 * 1024
  17. */
  18. maxBackpressure?: number;
  19. }
  20. /**
  21. * An Engine.IO server based on the `uWebSockets.js` package.
  22. */
  23. export declare class uServer extends BaseServer {
  24. protected init(): void;
  25. protected cleanup(): void;
  26. /**
  27. * Prepares a request by processing the query string.
  28. *
  29. * @private
  30. */
  31. private prepare;
  32. protected createTransport(transportName: string, req: EngineRequest): any;
  33. /**
  34. * Attach the engine to a µWebSockets.js server
  35. * @param app
  36. * @param options
  37. */
  38. attach(app: any, options?: AttachOptions & uOptions): void;
  39. _applyMiddlewares(req: any, res: any, callback: (err?: any) => void): void;
  40. private handleRequest;
  41. private handleUpgrade;
  42. private abortRequest;
  43. }