首先使用OpenSSL创建自签名证书:
> /path/to/- -key /path/to/.pem --req -days - csr.pem -signkey /path/to/.pem - /path/to/file.crt
使用ws模块创建wss服务器:
https=require( ws=require( fs=require( keypath=process.cwd()+; certpath=process.cwd()+; options = server=https.createServer(options, function (req, res) { res.writeHead(); res.end( wss = ws.Server( { server: server } );wss.on(
客户端链接:
ws = WebSocket(