我正在尝试为我网站上的 3 位开发人员创建自定义API 侦听器。它应该是这样的:
// Function will be fired when any user joins to room
API.on('user-join', function(data){
console.log(data); // Data is object with user id and name
});
我也有Socket.io 监听器:
// This handler is fired every time when anyone joins
socket.on('user-join', function(data){
// Probably here i should call a callback to API.on('user-join') with that data object
});
如何将 Socket.io 处理程序中的回调发送到我自定义创建的 API?请让我知道如何做到这一点。谢谢。
小怪兽爱吃肉
相关分类