大家好,这是我在socket.io服务器端的代码,我不知道如何在客户端调用这个函数。您能帮我或提供有关如何调用此函数的代码:
io.sockets.on('connection', function (socket){
sub.on('subscribe', function (channel) {
pub.publish('Privatex','Test Message 1');
pub.publish('Privatex','Test Message 2');
pub.publish('Privatex','Test Message 3');
});
sub.on('message', function (channel, message) {
console.log(channel + ':' + message);
sub.unsubscribe();
pub.end();
sub.end();
});
sub.incr('Channel Test');
sub.incr('Privatex');
});