Skip to content

refactor: Import WebSocketServer properly#3290

Merged
mondoreale merged 1 commit into
mainfrom
fix-ws-usage
Dec 11, 2025
Merged

refactor: Import WebSocketServer properly#3290
mondoreale merged 1 commit into
mainfrom
fix-ws-usage

Conversation

@mondoreale

@mondoreale mondoreale commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

Updates the dht package’s WebsocketServer to correctly use the named WebSocketServer export introduced in ws v8+, improving clarity and type consistency.

Note

The current WebSocket.Server way works as long as we target CJS and not ESM. The new way works for both.

Changes

  • Updated WebsocketServer.ts (mind the low-key "s") to import the server using the proper import { WebSocketServer } from 'ws' syntax, distinguishing it from the WebSocket client type.
  • Replaced all WebSocket.Server type references and instantiations with WebSocketServer for consistent and accurate typing.

@github-actions github-actions Bot added the dht Related to DHT package label Dec 11, 2025
@mondoreale mondoreale marked this pull request as ready for review December 11, 2025 16:47
@mondoreale mondoreale merged commit 060a4c2 into main Dec 11, 2025
23 checks passed
@mondoreale mondoreale deleted the fix-ws-usage branch December 11, 2025 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dht Related to DHT package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants