Websocket Handshake failed

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Websocket Handshake failed

murthy
>From some client machines (not all) I get this err message connecting
to the same server.

Could not connect websocket ws://xxx:3002/test/ err Websocket
Handshake failed: Invalid Sec-Websocket-Accept (expected
xihPkLi8kE/k3JHo0sG7oTrQm7Q= got nil)

Any ideas what this is about?

Thanks

Reply | Threaded
Open this post in threaded view
|

Re: Websocket Handshake failed

Michal Kottman-2
On Fri, Jan 3, 2020, 8:05 PM Srinivas Murthy <[hidden email]> wrote:
>From some client machines (not all) I get this err message connecting
to the same server.

Could not connect websocket ws://xxx:3002/test/ err Websocket
Handshake failed: Invalid Sec-Websocket-Accept (expected
xihPkLi8kE/k3JHo0sG7oTrQm7Q= got nil)

Any ideas what this is about?

Absolutely no idea. This mailing list is about the Lua programming language. There is zero reference to Lua in your message -maybe try the support group for your WS client/server framework/library.
Reply | Threaded
Open this post in threaded view
|

Re: Websocket Handshake failed

Oliver Kroth
In reply to this post by murthy
Hi,

You  have to create a coorect response key to signal the client that
your server really does understand websockets.
Read the RFC for the details.

My Lua based web socket server's implementation is:

local key = cgi.header('sec-websocket-key')

key = require('sha1')( key .. '258EAFA5-E914-47DA-95CA-C5AB0DC85B11',
false )
cgi.setheader( 'Sec-WebSocket-Accept', require('mime').b64( key ) )


--
Oliver Kroth


Am 03.01.20 um 19:56 schrieb Srinivas Murthy:

> >From some client machines (not all) I get this err message connecting
> to the same server.
>
> Could not connect websocket ws://xxx:3002/test/ err Websocket
> Handshake failed: Invalid Sec-Websocket-Accept (expected
> xihPkLi8kE/k3JHo0sG7oTrQm7Q= got nil)
>
> Any ideas what this is about?
>
> Thanks


Reply | Threaded
Open this post in threaded view
|

Re: Websocket Handshake failed

murthy
In my case the client is lua but the server side is java script.
On a CentOS 7 OS running the Lua client, I dont see the problem
connecting to the Websocket server. However, running on a Ubuntu 1604
OS, running the same Lua client, I see this problem.

Do you have any ideas to fix this?

Thanks



On Sun, Jan 5, 2020 at 4:13 AM Oliver Kroth <[hidden email]> wrote:

>
> Hi,
>
> You  have to create a coorect response key to signal the client that
> your server really does understand websockets.
> Read the RFC for the details.
>
> My Lua based web socket server's implementation is:
>
> local key = cgi.header('sec-websocket-key')
>
> key = require('sha1')( key .. '258EAFA5-E914-47DA-95CA-C5AB0DC85B11',
> false )
> cgi.setheader( 'Sec-WebSocket-Accept', require('mime').b64( key ) )
>
>
> --
> Oliver Kroth
>
>
> Am 03.01.20 um 19:56 schrieb Srinivas Murthy:
> > >From some client machines (not all) I get this err message connecting
> > to the same server.
> >
> > Could not connect websocket ws://xxx:3002/test/ err Websocket
> > Handshake failed: Invalid Sec-Websocket-Accept (expected
> > xihPkLi8kE/k3JHo0sG7oTrQm7Q= got nil)
> >
> > Any ideas what this is about?
> >
> > Thanks
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Websocket Handshake failed

Oliver Kroth
Hi Srinivas,

the same logic of RFC6455, section 1.3 (page 6-7) applies.
https://tools.ietf.org/html/rfc6455#page-6

Oliver Kroth

Am 06.01.20 um 19:04 schrieb Srinivas Murthy:

> In my case the client is lua but the server side is java script.
> On a CentOS 7 OS running the Lua client, I dont see the problem
> connecting to the Websocket server. However, running on a Ubuntu 1604
> OS, running the same Lua client, I see this problem.
>
> Do you have any ideas to fix this?
>
> Thanks
>
>
>
> On Sun, Jan 5, 2020 at 4:13 AM Oliver Kroth <[hidden email]> wrote:
>> Hi,
>>
>> You  have to create a coorect response key to signal the client that
>> your server really does understand websockets.
>> Read the RFC for the details.
>>
>> My Lua based web socket server's implementation is:
>>
>> local key = cgi.header('sec-websocket-key')
>>
>> key = require('sha1')( key .. '258EAFA5-E914-47DA-95CA-C5AB0DC85B11',
>> false )
>> cgi.setheader( 'Sec-WebSocket-Accept', require('mime').b64( key ) )
>>
>>
>> --
>> Oliver Kroth
>>
>>
>> Am 03.01.20 um 19:56 schrieb Srinivas Murthy:
>>> >From some client machines (not all) I get this err message connecting
>>> to the same server.
>>>
>>> Could not connect websocket ws://xxx:3002/test/ err Websocket
>>> Handshake failed: Invalid Sec-Websocket-Accept (expected
>>> xihPkLi8kE/k3JHo0sG7oTrQm7Q= got nil)
>>>
>>> Any ideas what this is about?
>>>
>>> Thanks
>>