2
我使用ws作爲我的node.js庫的套接字庫。
所以我的問題是,如果用戶沒有通過授權過程,我怎麼能拒絕一個連接。websockets - 拒絕套接字連接
var WebSocketServer = require('ws').Server;
var wss = new WebSocketServer({port: 6969});
wss.on('connection', function(socket){
// if the socket.upgradeReq.headers.cookie doesn't exists, reject the client
})
非常感謝
[相關的github問題](https://github.com/websockets/ws/issues/517) –