문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top