Earlier quoted context omitted.
It's the same thing as HTTP. Websocket starts off as an HTTP request with cookies, headers etc. Use those just like HTTP to authenticate, and your Websocket server should pass the user data to the websocket object
Don't have access to the headers from JS. Best solution might be to generate a short-lived one-time-use ticket and pass it in the querystring.
However, websockets are not subject to the same-origin policy, so this exposes you to CSRF [1]. To protect against that, you should check the Origin header on the server side.
[1] https://christian-schneider.net/CrossSiteWebSocketHijacking....