DefinitelyTyped/types/socket.io-parser/index.d.ts
Nathan Shively-Sanders f0ce987bc1 Update project urls to match NPM url
Note that this *trivially* updates project urls by adding the NPM url to
the end, even when the urls are almost identical or the DT one is
outdated. I'll clean up the urls in a later commit.

This PR is unfinished! Please do not merge it yet.
2019-02-11 17:10:55 -08:00

34 lines
976 B
TypeScript

// Type definitions for socket.io-parser 2.2
// Project: https://github.com/socketio/socket.io-parser, https://github.com/automattic/socket.io-parser
// Definitions by: York Yao <https://github.com/plantain-00>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export interface Packet {
type: number;
data: any;
id: number;
}
export type EncodedPacket = string | Buffer | ArrayBuffer | Blob;
export const types: string[];
export const CONNECT: number;
export const DISCONNECT: number;
export const EVENT: number;
export const ACK: number;
export const ERROR: number;
export const BINARY_EVENT: number;
export const BINARY_ACK: number;
export class Encoder {
encode(packet: Packet, callback: (encodedPackets: EncodedPacket[]) => void): void;
}
export class Decoder {
on(event: string, callback: (decodedPacket: Packet) => void): void;
add(encodedPacket: EncodedPacket): void;
destroy(): void;
}