Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.d.ts 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import { Emitter } from "@socket.io/component-emitter";
  2. /**
  3. * Protocol version.
  4. *
  5. * @public
  6. */
  7. export declare const protocol: number;
  8. export declare enum PacketType {
  9. CONNECT = 0,
  10. DISCONNECT = 1,
  11. EVENT = 2,
  12. ACK = 3,
  13. CONNECT_ERROR = 4,
  14. BINARY_EVENT = 5,
  15. BINARY_ACK = 6
  16. }
  17. export interface Packet {
  18. type: PacketType;
  19. nsp: string;
  20. data?: any;
  21. id?: number;
  22. attachments?: number;
  23. }
  24. /**
  25. * A socket.io Encoder instance
  26. */
  27. export declare class Encoder {
  28. private replacer?;
  29. /**
  30. * Encoder constructor
  31. *
  32. * @param {function} replacer - custom replacer to pass down to JSON.parse
  33. */
  34. constructor(replacer?: (this: any, key: string, value: any) => any);
  35. /**
  36. * Encode a packet as a single string if non-binary, or as a
  37. * buffer sequence, depending on packet type.
  38. *
  39. * @param {Object} obj - packet object
  40. */
  41. encode(obj: Packet): any[];
  42. /**
  43. * Encode packet as string.
  44. */
  45. private encodeAsString;
  46. /**
  47. * Encode packet as 'buffer sequence' by removing blobs, and
  48. * deconstructing packet into object with placeholders and
  49. * a list of buffers.
  50. */
  51. private encodeAsBinary;
  52. }
  53. interface DecoderReservedEvents {
  54. decoded: (packet: Packet) => void;
  55. }
  56. /**
  57. * A socket.io Decoder instance
  58. *
  59. * @return {Object} decoder
  60. */
  61. export declare class Decoder extends Emitter<{}, {}, DecoderReservedEvents> {
  62. private reviver?;
  63. private reconstructor;
  64. /**
  65. * Decoder constructor
  66. *
  67. * @param {function} reviver - custom reviver to pass down to JSON.stringify
  68. */
  69. constructor(reviver?: (this: any, key: string, value: any) => any);
  70. /**
  71. * Decodes an encoded packet string into packet JSON.
  72. *
  73. * @param {String} obj - encoded packet
  74. */
  75. add(obj: any): void;
  76. /**
  77. * Decode a packet String (JSON data)
  78. *
  79. * @param {String} str
  80. * @return {Object} packet
  81. */
  82. private decodeString;
  83. private tryParse;
  84. private static isPayloadValid;
  85. /**
  86. * Deallocates a parser's resources
  87. */
  88. destroy(): void;
  89. }
  90. export {};