【发布时间】:2012-05-11 09:57:45
【问题描述】:
是否可以让 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?
});
我希望在客户端 socket.io 代码收到任何/所有事件时调用此回调函数。
这可能吗?怎么样?
【问题讨论】:
-
我在转发所有事件类型时打开了以下问题,我也一直在添加我找到的解决方案:github.com/Automattic/socket.io/issues/1715
标签: javascript events socket.io