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.
Hixie-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 connection info.secure:
True if this connection is authorized or encrypted info.req:
The http.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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.