New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@types/ws

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/ws - npm Package Compare versions

Comparing version

to
8.18.0

62

ws/index.d.ts

@@ -13,2 +13,3 @@ /// <reference types="node" />

import { Server as HTTPSServer } from "https";
import { createConnection } from "net";
import { Duplex, DuplexOptions } from "stream";

@@ -30,2 +31,3 @@ import { SecureContextOptions } from "tls";

| SharedArrayBuffer
| Blob
| readonly any[]

@@ -119,3 +121,5 @@ | readonly number[]

type: K,
listener: (event: WebSocket.WebSocketEventMap[K]) => void,
listener:
| ((event: WebSocket.WebSocketEventMap[K]) => void)
| { handleEvent(event: WebSocket.WebSocketEventMap[K]): void },
options?: WebSocket.EventListenerOptions,

@@ -125,3 +129,5 @@ ): void;

type: K,
listener: (event: WebSocket.WebSocketEventMap[K]) => void,
listener:
| ((event: WebSocket.WebSocketEventMap[K]) => void)
| { handleEvent(event: WebSocket.WebSocketEventMap[K]): void },
): void;

@@ -131,3 +137,3 @@

on(event: "close", listener: (this: WebSocket, code: number, reason: Buffer) => void): this;
on(event: "error", listener: (this: WebSocket, err: Error) => void): this;
on(event: "error", listener: (this: WebSocket, error: Error) => void): this;
on(event: "upgrade", listener: (this: WebSocket, request: IncomingMessage) => void): this;

@@ -137,2 +143,3 @@ on(event: "message", listener: (this: WebSocket, data: WebSocket.RawData, isBinary: boolean) => void): this;

on(event: "ping" | "pong", listener: (this: WebSocket, data: Buffer) => void): this;
on(event: "redirect", listener: (this: WebSocket, url: string, request: ClientRequest) => void): this;
on(

@@ -145,3 +152,3 @@ event: "unexpected-response",

once(event: "close", listener: (this: WebSocket, code: number, reason: Buffer) => void): this;
once(event: "error", listener: (this: WebSocket, err: Error) => void): this;
once(event: "error", listener: (this: WebSocket, error: Error) => void): this;
once(event: "upgrade", listener: (this: WebSocket, request: IncomingMessage) => void): this;

@@ -151,2 +158,3 @@ once(event: "message", listener: (this: WebSocket, data: WebSocket.RawData, isBinary: boolean) => void): this;

once(event: "ping" | "pong", listener: (this: WebSocket, data: Buffer) => void): this;
once(event: "redirect", listener: (this: WebSocket, url: string, request: ClientRequest) => void): this;
once(

@@ -159,3 +167,3 @@ event: "unexpected-response",

off(event: "close", listener: (this: WebSocket, code: number, reason: Buffer) => void): this;
off(event: "error", listener: (this: WebSocket, err: Error) => void): this;
off(event: "error", listener: (this: WebSocket, error: Error) => void): this;
off(event: "upgrade", listener: (this: WebSocket, request: IncomingMessage) => void): this;

@@ -165,2 +173,3 @@ off(event: "message", listener: (this: WebSocket, data: WebSocket.RawData, isBinary: boolean) => void): this;

off(event: "ping" | "pong", listener: (this: WebSocket, data: Buffer) => void): this;
off(event: "redirect", listener: (this: WebSocket, url: string, request: ClientRequest) => void): this;
off(

@@ -173,3 +182,3 @@ event: "unexpected-response",

addListener(event: "close", listener: (code: number, reason: Buffer) => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "error", listener: (error: Error) => void): this;
addListener(event: "upgrade", listener: (request: IncomingMessage) => void): this;

@@ -179,2 +188,3 @@ addListener(event: "message", listener: (data: WebSocket.RawData, isBinary: boolean) => void): this;

addListener(event: "ping" | "pong", listener: (data: Buffer) => void): this;
addListener(event: "redirect", listener: (url: string, request: ClientRequest) => void): this;
addListener(

@@ -187,3 +197,3 @@ event: "unexpected-response",

removeListener(event: "close", listener: (code: number, reason: Buffer) => void): this;
removeListener(event: "error", listener: (err: Error) => void): this;
removeListener(event: "error", listener: (error: Error) => void): this;
removeListener(event: "upgrade", listener: (request: IncomingMessage) => void): this;

@@ -193,2 +203,3 @@ removeListener(event: "message", listener: (data: WebSocket.RawData, isBinary: boolean) => void): this;

removeListener(event: "ping" | "pong", listener: (data: Buffer) => void): this;
removeListener(event: "redirect", listener: (url: string, request: ClientRequest) => void): this;
removeListener(

@@ -264,4 +275,7 @@ event: "unexpected-response",

rejectUnauthorized?: boolean | undefined;
allowSynchronousEvents?: boolean | undefined;
autoPong?: boolean | undefined;
maxPayload?: number | undefined;
skipUTF8Validation?: boolean | undefined;
createConnection?: typeof createConnection | undefined;
finishRequest?: FinishRequestCallback | undefined;

@@ -343,2 +357,4 @@ }

noServer?: boolean | undefined;
allowSynchronousEvents?: boolean | undefined;
autoPong?: boolean | undefined;
clientTracking?: boolean | undefined;

@@ -379,6 +395,13 @@ perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined;

// Events
on(event: "connection", cb: (this: Server<T>, socket: InstanceType<T>, request: InstanceType<U>) => void): this;
on(
event: "connection",
cb: (this: Server<T>, websocket: InstanceType<T>, request: InstanceType<U>) => void,
): this;
on(event: "error", cb: (this: Server<T>, error: Error) => void): this;
on(event: "headers", cb: (this: Server<T>, headers: string[], request: InstanceType<U>) => void): this;
on(event: "close" | "listening", cb: (this: Server<T>) => void): this;
on(
event: "wsClientError",
cb: (this: Server<T>, error: Error, socket: Duplex, request: InstanceType<U>) => void,
): this;
on(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this;

@@ -388,3 +411,3 @@

event: "connection",
cb: (this: Server<T>, socket: InstanceType<T>, request: InstanceType<U>) => void,
cb: (this: Server<T>, websocket: InstanceType<T>, request: InstanceType<U>) => void,
): this;

@@ -394,2 +417,6 @@ once(event: "error", cb: (this: Server<T>, error: Error) => void): this;

once(event: "close" | "listening", cb: (this: Server<T>) => void): this;
once(
event: "wsClientError",
cb: (this: Server<T>, error: Error, socket: Duplex, request: InstanceType<U>) => void,
): this;
once(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this;

@@ -404,14 +431,23 @@

off(event: "close" | "listening", cb: (this: Server<T>) => void): this;
off(
event: "wsClientError",
cb: (this: Server<T>, error: Error, socket: Duplex, request: InstanceType<U>) => void,
): this;
off(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this;
addListener(event: "connection", cb: (client: InstanceType<T>, request: InstanceType<U>) => void): this;
addListener(event: "error", cb: (err: Error) => void): this;
addListener(event: "connection", cb: (websocket: InstanceType<T>, request: InstanceType<U>) => void): this;
addListener(event: "error", cb: (error: Error) => void): this;
addListener(event: "headers", cb: (headers: string[], request: InstanceType<U>) => void): this;
addListener(event: "close" | "listening", cb: () => void): this;
addListener(event: "wsClientError", cb: (error: Error, socket: Duplex, request: InstanceType<U>) => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
removeListener(event: "connection", cb: (client: InstanceType<T>, request: InstanceType<U>) => void): this;
removeListener(event: "error", cb: (err: Error) => void): this;
removeListener(event: "connection", cb: (websocket: InstanceType<T>, request: InstanceType<U>) => void): this;
removeListener(event: "error", cb: (error: Error) => void): this;
removeListener(event: "headers", cb: (headers: string[], request: InstanceType<U>) => void): this;
removeListener(event: "close" | "listening", cb: () => void): this;
removeListener(
event: "wsClientError",
cb: (error: Error, socket: Duplex, request: InstanceType<U>) => void,
): this;
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;

@@ -418,0 +454,0 @@ }

{
"name": "@types/ws",
"version": "8.5.14",
"version": "8.18.0",
"description": "TypeScript definitions for ws",

@@ -70,4 +70,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ws",

"peerDependencies": {},
"typesPublisherContentHash": "4f28320da3aae9bcd0905e47ff3eb3a16b1882e182a1b60100f36e518359b5a7",
"typesPublisherContentHash": "ebbd09d0d46be05a9803566b665294d42c112101dfce09d32b45de9885c66bc1",
"typeScriptVersion": "5.0"
}

@@ -11,3 +11,3 @@ # Installation

### Additional Details
* Last updated: Thu, 23 Jan 2025 16:36:36 GMT
* Last updated: Tue, 04 Mar 2025 19:02:11 GMT
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)

@@ -14,0 +14,0 @@

Sorry, the diff of this file is not supported yet