Headers for WebSocket handshake
Posted: 29 Sep 2016 16:35
On a # Z-Way Home Automation Engine v2.0.0-powered Raspberry in my automation module I'm using the following code:
and it's all working fine.
On the server I can see the connection request headers:
What's the best way to do it?
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 );
On the server I can see the connection request headers:
Now I need to add some extra headers upon handshake, but can't find any documentation on that.[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]
What's the best way to do it?