Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Authorization or Headers with Cro::WebSocket::Client?

I'm using Cro HTTP Authentication/Authorization/Sessions very successfully with HTTP routes.

Then I added a route that creates a web-socket using Cro::HTTP::Router::WebSocket, and I can connect to it with Cro::WebSocket::Client and everything works fine.

Now I want to control access to the websocket, so I add a Cro::HTTP::Auth parameter. Works great. Now the the client gets a 401 Unauthorized as expected.

Next step, how do I open the door?

With Cro::HTTP::Client, I can pass in an Authorization header, or even pass in the auth option. How do I do that with Cro::WebSocket::Client?

I'm very new to WebSocket, so I don't even know if this is the right way to do things like this, but it seems like the Cro::WebSocket::Client connect method should take a headers named option that gets extra headers that get passed along.

like image 853
Curt Tilmes Avatar asked Sep 19 '18 21:09

Curt Tilmes


1 Answers

The mentioned patch from titsuki was merged by Jonathan Worthington with commit 2593e21 on Oct 14, 2018

like image 187
LuVa Avatar answered Oct 25 '22 17:10

LuVa