Can someone explain me what disableHixie, clientTracking in nodejs websocket library 'ws' means:
new ws.Server([options], [callback])
options Object
host String
port Number
server http.Server
verifyClient Function
path String
noServer Boolean
disableHixie Boolean
clientTracking Boolean
callback Function
I can't find a conclusive description what it means.
Can someone explain me what disableHixie, clientTracking in nodejs websocket library 'ws' means:
new ws.Server([options], [callback])
options Object
host String
port Number
server http.Server
verifyClient Function
path String
noServer Boolean
disableHixie Boolean
clientTracking Boolean
callback Function
I can't find a conclusive description what it means.
Share Improve this question asked Aug 23, 2013 at 10:22 Luman75Luman75 9081 gold badge12 silver badges28 bronze badges1 Answer
Reset to default 18Hixie-76 is an old and deprecated protocol supported by WebSocket, but this protocol is still in use in some versions of Safari and Opera. Default value in library 'ws' is false, but you can disable the setting and set the disableHixie option to true.
The clientTracking option provides access to a collection of active WebSocket clients. Default value is true. See below:
var wss = new WebSocketServer({server:app });
wss.on('connection', function (ws) {
.....
console.log('Total clients: ', wss.clients.length);
....
}
Edit: additional information:
The verifyClient function allows you to add any custom code to accept or reject incoming connections. Your code receives an info
object with three members:
info.origin:
The origin of the connectioninfo.secure:
True if this connection is authorized or encryptedinfo.req:
Thehttp.Server
request object for this connection
The verifyClient
function can take one of the two forms:
var wss1 = new WebSocketServer ({ ...,
verifyClient: function(info) {
# ...check data in info and return true or false...
}
);
var wss2 = new WebSocketServer ({ ...,
verifyClient: function(info, callback){
# ...check data in info and call
# callback(true) for success or
# callback(false) for failure
}
});
The first form is simpler if you can validate the client immediately. For asynchronous validation, use the second form.