Vigia

Nâng cấp ws từ 7.x lên 8.x

So sánh API công khai của ws 7.5.13 và 8.22.0, được tính tự động từ kiểu TypeScript. Chữ ký thay đổi là thay đổi có thể không tương thích, không phải điều chắc chắn.

Tóm tắt

Đường dẫn import bị xóa0
Export bị xóa1
Chữ ký thay đổi2
Thành viên lớp hoặc interface bị xóa0
Thành viên lớp hoặc interface thay đổi13
Mới bị ngừng hỗ trợ0
Thay đổi yêu cầu (engines, phụ thuộc peer)2
Export mới6

Export bị xóa

importexportkindTrước
wsOpenEventinterfaceinterface

Chữ ký thay đổi

exportTrướcSau
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

Thành viên lớp hoặc interface bị xóa

Không phát hiện.

Thành viên lớp hoặc interface thay đổi

memberTrướcSau
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

Mới bị ngừng hỗ trợ

Không phát hiện.

Thay đổi yêu cầu (engines, phụ thuộc peer)

TrướcSau
engines.node>=8.3.0>=10.0.0
peerDependencies.utf-8-validate^5.0.2>=5.0.2
Export mới (6)
importexportkind
wsEventinterface
wsRawDatatype
wsWebSocketinterface
wsWebSocketServerinterface
wsWebSocketEventMapinterface
wsFinishRequestCallbacktype

Câu hỏi thường gặp

Nâng cấp ws từ 7 lên 8 có những thay đổi không tương thích nào?

Giữa ws 7.5.13 và 8.22.0, Vigia tìm thấy 1 export bị xóa, 2 chữ ký thay đổi và 13 thành viên lớp hoặc interface bị xóa hay thay đổi.

Những gì bị ngừng hỗ trợ trong ws 8?

0 export hoặc thành viên mới bị đánh dấu ngừng hỗ trợ trong ws 8.22.0.

Dành cho tác tử

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