@types/ws
Advanced tools
Comparing version 8.5.0 to 8.5.1
@@ -67,2 +67,3 @@ // Type definitions for ws 8.5 | ||
constructor(address: null); | ||
constructor(address: string | URL, options?: WebSocket.ClientOptions | ClientRequestArgs); | ||
@@ -295,2 +296,3 @@ constructor( | ||
skipUTF8Validation?: boolean | undefined; | ||
WebSocket?: typeof WebSocket.WebSocket | undefined; | ||
} | ||
@@ -305,6 +307,6 @@ | ||
// WebSocket Server | ||
class Server extends EventEmitter { | ||
class Server<T extends WebSocket = WebSocket> extends EventEmitter { | ||
options: ServerOptions; | ||
path: string; | ||
clients: Set<WebSocket>; | ||
clients: Set<T>; | ||
@@ -319,3 +321,3 @@ constructor(options?: ServerOptions, callback?: () => void); | ||
upgradeHead: Buffer, | ||
callback: (client: WebSocket, request: IncomingMessage) => void, | ||
callback: (client: T, request: IncomingMessage) => void, | ||
): void; | ||
@@ -325,21 +327,21 @@ shouldHandle(request: IncomingMessage): boolean | Promise<boolean>; | ||
// Events | ||
on(event: "connection", cb: (this: Server, socket: WebSocket, request: IncomingMessage) => void): this; | ||
on(event: "error", cb: (this: Server, error: Error) => void): this; | ||
on(event: "headers", cb: (this: Server, headers: string[], request: IncomingMessage) => void): this; | ||
on(event: "close" | "listening", cb: (this: Server) => void): this; | ||
on(event: string | symbol, listener: (this: Server, ...args: any[]) => void): this; | ||
on(event: "connection", cb: (this: Server<T>, socket: T, request: IncomingMessage) => void): this; | ||
on(event: "error", cb: (this: Server<T>, error: Error) => void): this; | ||
on(event: "headers", cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void): this; | ||
on(event: "close" | "listening", cb: (this: Server<T>) => void): this; | ||
on(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this; | ||
once(event: "connection", cb: (this: Server, socket: WebSocket, request: IncomingMessage) => void): this; | ||
once(event: "error", cb: (this: Server, error: Error) => void): this; | ||
once(event: "headers", cb: (this: Server, headers: string[], request: IncomingMessage) => void): this; | ||
once(event: "close" | "listening", cb: (this: Server) => void): this; | ||
once(event: string | symbol, listener: (...args: any[]) => void): this; | ||
once(event: "connection", cb: (this: Server<T>, socket: T, request: IncomingMessage) => void): this; | ||
once(event: "error", cb: (this: Server<T>, error: Error) => void): this; | ||
once(event: "headers", cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void): this; | ||
once(event: "close" | "listening", cb: (this: Server<T>) => void): this; | ||
once(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this; | ||
off(event: "connection", cb: (this: Server, socket: WebSocket, request: IncomingMessage) => void): this; | ||
off(event: "error", cb: (this: Server, error: Error) => void): this; | ||
off(event: "headers", cb: (this: Server, headers: string[], request: IncomingMessage) => void): this; | ||
off(event: "close" | "listening", cb: (this: Server) => void): this; | ||
off(event: string | symbol, listener: (this: Server, ...args: any[]) => void): this; | ||
off(event: "connection", cb: (this: Server<T>, socket: T, request: IncomingMessage) => void): this; | ||
off(event: "error", cb: (this: Server<T>, error: Error) => void): this; | ||
off(event: "headers", cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void): this; | ||
off(event: "close" | "listening", cb: (this: Server<T>) => void): this; | ||
off(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this; | ||
addListener(event: "connection", cb: (client: WebSocket, request: IncomingMessage) => void): this; | ||
addListener(event: "connection", cb: (client: T, request: IncomingMessage) => void): this; | ||
addListener(event: "error", cb: (err: Error) => void): this; | ||
@@ -350,3 +352,3 @@ addListener(event: "headers", cb: (headers: string[], request: IncomingMessage) => void): this; | ||
removeListener(event: "connection", cb: (client: WebSocket) => void): this; | ||
removeListener(event: "connection", cb: (client: T) => void): this; | ||
removeListener(event: "error", cb: (err: Error) => void): this; | ||
@@ -353,0 +355,0 @@ removeListener(event: "headers", cb: (headers: string[], request: IncomingMessage) => void): this; |
{ | ||
"name": "@types/ws", | ||
"version": "8.5.0", | ||
"version": "8.5.1", | ||
"description": "TypeScript definitions for ws", | ||
@@ -60,3 +60,3 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ws", | ||
}, | ||
"typesPublisherContentHash": "5aa556a794e24717053cb3820ed284b515582a924b486950c7cea74f18267af8", | ||
"typesPublisherContentHash": "44cfe58679c6fe88514fa1a812d2e19ae226568e93a3aec698193a9d4f8cbc18", | ||
"typeScriptVersion": "3.8", | ||
@@ -63,0 +63,0 @@ "exports": { |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Wed, 23 Feb 2022 20:01:43 GMT | ||
* Last updated: Thu, 24 Feb 2022 22:01:44 GMT | ||
* Dependencies: [@types/node](https://npmjs.com/package/@types/node) | ||
@@ -14,0 +14,0 @@ * Global values: none |
Copyleft License
License(Experimental) Copyleft license information was found
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found
Found 1 instance in 1 package
20273
322
3