有没有可能有一个socket.io客户端响应所有事件而没有单独指定每个事件?Socket.io客户端:用一个处理程序响应所有事件?
例如,这样的事情(这显然目前不工作):
var socket = io.connect("http://myserver");
socket.on("*", function(){
// listen to any and all events that are emitted from the
// socket.io back-end server, and handle them here.
// is this possible? how can i do this?
});
我想这个回调函数,当任何/所有事情都是由客户端收到的插座被调用。 io代码。
这可能吗?怎么样?
我打开在转发所有事件类型时遇到以下问题,我还添加了我找到的解决方案: https://github.com/Automattic/socket.io/issues/1715 –