node.js - onping事件不能触发
PHPz
PHPz 2017-04-17 16:33:42
0
0
542

服务端(用的ws,node.js)发送了一个ping事件但是客户端这里的onping却没有触发,这是为什么啊?

//server
wss.on("connection", function connection(ws) {
    ws.on('message', function(message) {
        console.log('received: %s', message);
    });

    ws.ping('ping');
});
//client
 ws.onping = function () {
            console.log('receive ping');
        };
PHPz
PHPz

学习是最好的投资!

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template