Domanda

If so, how does it get the public certificate and private key to encrypt/decrypt WebSocket packets?

È stato utile?

Soluzione

Both Engine.IO and Socket.IO are able to listen on an instance of a HTTPS server. As HTTPS is HTTP over TLS, WSS is WS over TLS.

var fs = require('fs');
var https = require('https');
var server = https.createServer({
  key: fs.readFileSync('key'),
  cert: fs.readFileSync('cert')
});

var eio = require('engine.io').attach(server);
var io = require('socket.io').listen(server);

As far as I know, encryption and decryption is done by the browser.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top