Exact format for WebSocket request header?

No not upset at all. Just unsure as to Why you are coming at it from this direction, when people more clever than you are I are building libraries to manage the “basics” of opening a connection, and if I wanted to learn I’d go to the WS code rather than trying to connect to Twitch.

If you want to learn how to essentially build a library that connects to a WebSocket, you’d be better suited looking at how libraries such as WS and how they follow the specification, work as apposed to looking at Twitch.

I was talking in general, not nodeJS specifically.

On the matter of nodeJS, I recal reading there is talk of bringing WS into node “natively” so it’s not a module you have to install seperately.

You can continue down this path, but I doubt anyone has an answer. Since they don’t come at this problem (connecting to chat/pubsub via websockets at the rarest/basest level). And my point is that Websocket servers should all work the same, regardless of whom you are connecting to, so you are better looking at how the WS libraries (or similar) work to follow the spec, rather than poking about at Twitch.

EDIT

A quick look in inspector returns the request headers, that the browser WS library (in chrome) called to create the connection(s)

Chat headers:

PubSub headers:

EDIT 2 So I went and looked up the specification.

You can also refer to the specification, section 4 on page 17

Which also covers the required (and optional) headers.