najamelan / ws_stream_wasm

Wasm convenience API for WebSockets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

passing headers on connect

databasedav opened this issue · comments

WsMeta::connect takes url and protocols, how do we pass headers?

Hi, which headers are we talking about? This is a TCP connection with websocket on top. See the MDN documentation of the Js API this wraps. It does not take headers.

oof, all the websocket clients i've used in the past have allowed specifying headers, but this is the first time i'm working in the browser and didn't realize the web API was so basic, it looks like simply passing the authorization header in the protocols is a common workaround to this

thanks