Monday, 17 April 2017

socket io private chat is not working

I am developing a chat application using android. my client part is android. When i doing private chat is not working. I want to send to abc1. The message only shows on abc1. My codes are shown below.

Client

mSocket.emit("send message", "msg data", "abc1");

server

socket.on('send message', function (message, to) {
console.log('send message');

  socket.to(to.userId).emit('new message', {
    username: socket.username,
    message: message,
    timestamp: Date.now()
  });
});

It will print the send message. But the abc1 is not showing any thing. How it possible? please help me?



via Fazil

No comments:

Post a Comment