FredyH / GWSockets

WebSockets for GLua
MIT License
87 stars 7 forks source link

Headers don't work #15

Closed mason-rogers closed 4 years ago

mason-rogers commented 4 years ago

My code for initializing a WS connection from gmod is

CLIENT = GWSockets.createWebSocket("ws://" .. Project.Globals.API.GetAPIBase() .. "/server/io", false)
CLIENT:setHeader("Authorization", Project.API.Key)

... -- omitted event handlers

CLIENT:open()

And for some reason when I log the headers on the receiving end of the connection, the Authorization header is not there...

Having a different header name changes nothing whether it is all lowercase, all uppercase. Any explanation or fix for this would be useful.

FredyH commented 4 years ago

The setHeader function returns a boolean indicating whether or not setting the header actually worked, presumably it returns false for whatever reason, could you just make sure that is the case? Nevermind, it looks like it'd throw a LUA error if the internal function for it returned false.

Could you do me a favour and check if it works with GWSockets 1.0.0? If it does not it probably has never worked.

mason-rogers commented 4 years ago

Yea, it seems to work fine with 1.0.0, should I just use that for the time being?

FredyH commented 4 years ago

I fixed it in 1.1.2.