阅读背景:

套接字。io socket.broadcast。不工作

来源:互联网 

I have in my Express server

我的快递服务器上有。

userbase = {'Fitz': '84Iw3MNEIMaed0GoAAAD'}; //Exapmle user to receive message and associated socket id



//Sending message to Example user
    socket.on('send_msg',function(data_from_client){



       //Testing  for receivers socketId


     console.log(userbase[data_from_client.to_user]);//This returns the socket id for Fitz in userbase successfully i.e 84Iw3MNEIMaed0GoAAAD



      socket.broadcast.to(userbase[data_from_client.to_user]).emit('get_msg',{msg:data_server.msg});
    });
use



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: