79299627

Date: 2024-12-21 15:15:59
Score: 1.5
Natty:
Report link

From nodejs v22 now you can pass a WebSocketInit as the second parameter. Example:

var ws = new WebSocket(url, {
  protocols: ...
  headers: {
    'User-Agent': 'xxx',
    ...
  },
})

Though this is not been written in MDN Docs, but nodejs chose undici as WHATWG implementation, like fetch/WebSocket.

Reasons:
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: LitileXueZha