This updates the WebSocket connector to pass headers (if provided) the same way that the connector does for HTTP polling/streaming connections do. It's slightly different in that the WebSocket source stores a tungstenite::handshake::client::Request built via tokio_tungstenite::tungstenite::client::IntoClientRequest which automatically fills in necessary headers (namely sec-websocket-key).
I find this functionality necessary to connect to some third-party websocket servers, particularly Kalshi's WebSocket Market Data Feed, which requires a bearer token in an Authorization header to connect.
For reference, my connection config for Kalshi now looks like:
This updates the WebSocket connector to pass headers (if provided) the same way that the connector does for HTTP polling/streaming connections do. It's slightly different in that the WebSocket source stores a
tungstenite::handshake::client::Request
built viatokio_tungstenite::tungstenite::client::IntoClientRequest
which automatically fills in necessary headers (namelysec-websocket-key
).I find this functionality necessary to connect to some third-party websocket servers, particularly Kalshi's WebSocket Market Data Feed, which requires a bearer token in an
Authorization
header to connect.For reference, my connection config for Kalshi now looks like: