有沒有可能有一個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 –