lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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 <oliver.kroth@nec-i.de> 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