mirror of
https://github.com/koush/scrypted.git
synced 2026-02-13 10:22:57 +00:00
server: engine io type shim
This commit is contained in:
23
server/src/io.ts
Normal file
23
server/src/io.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Server, Socket } from "engine.io";
|
||||
|
||||
export type IOServer<T> = {
|
||||
on(ev: 'connection' | 'drain', fn: (socket: IOSocket & T) => void): IOServer<T>;
|
||||
} & Server;
|
||||
|
||||
export type IOSocket = {
|
||||
send(data: any, options?: any, callback?: any): IOSocket;
|
||||
|
||||
on(ev: "close", fn: (reason: string, description?: Error) => void): IOSocket;
|
||||
/**
|
||||
* Fired when the client sends a message.
|
||||
*/
|
||||
on(ev: "message", fn: (data: string | Buffer) => void): IOSocket;
|
||||
/**
|
||||
* Fired when an error occurs.
|
||||
*/
|
||||
on(ev: "error", fn: (err: Error) => void): IOSocket;
|
||||
/**
|
||||
* Called when the write buffer is drained
|
||||
*/
|
||||
on(ev: "drain", fn: () => void): IOSocket;
|
||||
};
|
||||
Reference in New Issue
Block a user