Vigia

Upgrading ws from 7.x to 8.x

Comparison of the public API of ws 7.5.13 and 8.22.0, computed automatically from their TypeScript types. A changed signature is a candidate for a breaking change, not a certainty.

Summary

Removed import paths0
Removed exports1
Changed signatures2
Removed class or interface members0
Changed class or interface members13
Newly deprecated0
Requirement changes (engines, peer dependencies)2
New exports6

Removed exports

importexportkindBefore
wsOpenEventinterfaceinterface

Changed signatures

exportBeforeAfter
ws · VerifyClientCallbackSync(info: { origin: string; secure: boolean; req: IncomingMessage; }) => boolean(info: { origin: string; secure: boolean; req: Request; }) => boolean
ws · VerifyClientCallbackAsync(info: { origin: string; secure: boolean; req: IncomingMessage; }, callback: (res: boolean, code?: number | undefined, message?: string | undefined, headers?: any) => void) => void(info: { origin: string; secure: boolean; req: Request; }, callback: (res: boolean, code?: number | undefined, message?: string | undefined, headers?: any) => void) => void

Removed class or interface members

None detected.

Changed class or interface members

memberBeforeAfter
Server.on(event: "connection", cb: (this: Server, socket: WebSocket, request: IncomingMessage) => void): Server | (event: "error", cb: (this: Server, error: Error) => void): Server | (event: "headers", cb: (this: Server, headers: string[], request: IncomingMessage) => void): Server | (event: "close" | "liste…(event: "connection", cb: (this: Server<T, any>, websocket: InstanceType<T>, request: InstanceType<U>) => void): Server<T, U> | (event: "error", cb: (this: Server<T, any>, error: Error) => void): Server<T, U> | (event: "headers", cb: (this: Server<T, any>, headers: string[], request: InstanceType<U>…
Server.off(event: "connection", cb: (this: Server, socket: WebSocket, request: IncomingMessage) => void): Server | (event: "error", cb: (this: Server, error: Error) => void): Server | (event: "headers", cb: (this: Server, headers: string[], request: IncomingMessage) => void): Server | (event: "close" | "liste…(event: "connection", cb: (this: Server<T, any>, socket: InstanceType<T>, request: InstanceType<U>) => void): Server<T, U> | (event: "error", cb: (this: Server<T, any>, error: Error) => void): Server<T, U> | (event: "headers", cb: (this: Server<T, any>, headers: string[], request: InstanceType<U>) =…
Server.once(event: "connection", cb: (this: Server, socket: WebSocket, request: IncomingMessage) => void): Server | (event: "error", cb: (this: Server, error: Error) => void): Server | (event: "headers", cb: (this: Server, headers: string[], request: IncomingMessage) => void): Server | (event: "close" | "liste…(event: "connection", cb: (this: Server<T, any>, websocket: InstanceType<T>, request: InstanceType<U>) => void): Server<T, U> | (event: "error", cb: (this: Server<T, any>, error: Error) => void): Server<T, U> | (event: "headers", cb: (this: Server<T, any>, headers: string[], request: InstanceType<U>…
Server.address(): string | AddressInfo(): string | AddressInfo | null
Server.clientsSet<WebSocket>Set<InstanceType<T>>
Server.optionsServerOptionsServerOptions<T, U>
Server.addListener(event: "connection", cb: (client: WebSocket, request: IncomingMessage) => void): Server | (event: "error", cb: (err: Error) => void): Server | (event: "headers", cb: (headers: string[], request: IncomingMessage) => void): Server | (event: "close" | "listening", cb: () => void): Server | (event: str…(event: "connection", cb: (websocket: InstanceType<T>, request: InstanceType<U>) => void): Server<T, U> | (event: "error", cb: (error: Error) => void): Server<T, U> | (event: "headers", cb: (headers: string[], request: InstanceType<U>) => void): Server<T, U> | (event: "close" | "listening", cb: () =…
Server.constructor(options?: ServerOptions | undefined, callback?: (() => void) | undefined): Server<T extends typeof WebSocket.WebSocket = typeof WebSocket, U extends typeof IncomingMessage = any>(options?: ServerOptions<T, U> | undefined, callback?: (() => void) | undefined): Server<T, U>
Server.shouldHandle(request: IncomingMessage): boolean | Promise<boolean>(request: InstanceType<U>): boolean | Promise<boolean>
Server.handleUpgrade(request: IncomingMessage, socket: Socket, upgradeHead: Buffer, callback: (client: WebSocket, request: IncomingMessage) => void): void(request: InstanceType<U>, socket: Duplex, upgradeHead: Buffer, callback: (client: InstanceType<T>, request: InstanceType<U>) => void): void
Server.removeListener(event: "connection", cb: (client: WebSocket) => void): Server | (event: "error", cb: (err: Error) => void): Server | (event: "headers", cb: (headers: string[], request: IncomingMessage) => void): Server | (event: "close" | "listening", cb: () => void): Server | (event: string | symbol, listener: (.…(event: "connection", cb: (websocket: InstanceType<T>, request: InstanceType<U>) => void): Server<T, U> | (event: "error", cb: (error: Error) => void): Server<T, U> | (event: "headers", cb: (headers: string[], request: InstanceType<U>) => void): Server<T, U> | (event: "close" | "listening", cb: () =…
ServerOptions.verifyClientVerifyClientCallbackSync | VerifyClientCallbackAsync | undefinedVerifyClientCallbackAsync<InstanceType<V>> | VerifyClientCallbackSync<InstanceType<V>> | undefined
ServerOptions.handleProtocolsany((protocols: Set<string>, request: InstanceType<V>) => string | false) | undefined

Newly deprecated

None detected.

Requirement changes (engines, peer dependencies)

BeforeAfter
engines.node>=8.3.0>=10.0.0
peerDependencies.utf-8-validate^5.0.2>=5.0.2
New exports (6)
importexportkind
wsEventinterface
wsRawDatatype
wsWebSocketinterface
wsWebSocketServerinterface
wsWebSocketEventMapinterface
wsFinishRequestCallbacktype

Frequently asked questions

What are the breaking changes when upgrading ws from 7 to 8?

Between ws 7.5.13 and 8.22.0, Vigia found 1 removed exports, 2 changed signatures and 13 removed or changed class or interface members.

What became deprecated in ws 8?

0 exports or members are newly marked as deprecated in ws 8.22.0.

For agents

GET https://vigia.coredls.cloud/v1/packages/npm/ws/upgrade?from=7.5.13&to=8.22.0