WsFrameEncoder.d.ts 925 B

1234567891011121314151617
  1. import { WsFrameOpcode } from './constants';
  2. import type { IWriter, IWriterGrowable } from '@jsonjoy.com/util/lib/buffers';
  3. export declare class WsFrameEncoder<W extends IWriter & IWriterGrowable = IWriter & IWriterGrowable> {
  4. readonly writer: W;
  5. constructor(writer?: W);
  6. encodePing(data: Uint8Array | null): Uint8Array;
  7. encodePong(data: Uint8Array | null): Uint8Array;
  8. encodeClose(reason: string, code?: number): Uint8Array;
  9. encodeHdr(fin: 0 | 1, opcode: WsFrameOpcode, length: number, mask: number): Uint8Array;
  10. encodeDataMsgHdrFast(length: number): Uint8Array;
  11. writePing(data: Uint8Array | null): void;
  12. writePong(data: Uint8Array | null): void;
  13. writeClose(reason: string, code?: number): void;
  14. writeHdr(fin: 0 | 1, opcode: WsFrameOpcode, length: number, mask: number): void;
  15. writeDataMsgHdrFast(length: number): void;
  16. writeBufXor(buf: Uint8Array, mask: number): void;
  17. }