Headers for WebSocket handshake

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
injecteer
Posts: 13
Joined: 29 Sep 2016 16:28

Headers for WebSocket handshake

Post by injecteer »

On a # Z-Way Home Automation Engine v2.0.0-powered Raspberry in my automation module I'm using the following code:

Code: Select all

  
var ws = new sockets.websocket( wsUrl );
ws.onopen = function ( e ) {
    console.log( 'WebSocket opened @[' + wsUrl + ']' );
}
ws.onmessage = function ( e ) {...};
ws.send( someObj );
and it's all working fine.

On the server I can see the connection request headers:
[Pragma=no-cache, Cache-Control=no-cache, Host=192.168.0.113:8822, Upgrade=websocket, Connection=Upgrade, Sec-WebSocket-Key=25p00PnBptREGXYdGcq9Dg==, Sec-WebSocket-Extensions=x-webkit-deflate-frame,deflate-frame, Sec-WebSocket-Version=13]
Now I need to add some extra headers upon handshake, but can't find any documentation on that.

What's the best way to do it?
User avatar
PoltoS
Posts: 7649
Joined: 26 Jan 2011 19:36

Re: Headers for WebSocket handshake

Post by PoltoS »

This is not supported by our pretty basic websockets
injecteer
Posts: 13
Joined: 29 Sep 2016 16:28

Re: Headers for WebSocket handshake

Post by injecteer »

Is the websocket module written in Javascript or in some native code? When former, where can I find the implementation?
User avatar
PoltoS
Posts: 7649
Joined: 26 Jan 2011 19:36

Re: Headers for WebSocket handshake

Post by PoltoS »

It is in native C based on libwebsockets library
Post Reply