0

In the socket.io client socket section of the doc http://socket.io/docs/client-api/#io#socket refers to Socket docs, which implies both server Socket object and client Socket object are the same.

Also the docs http://socket.io/docs/rooms-and-namespaces/#default-room here has the following code which has a broadcast object attached to socket object. ie. socket.broadcast.

io.on('connection', function(socket){
  socket.on('say to someone', function(id, msg){
    socket.broadcast.to(id).emit('my message', msg);
  });
});

However the socket.broadcast property is not accessible on the client side. It throws Type Error. Does this mean that broadcasting can not be done from client side.

Talespin_Kit
  • 20,830
  • 29
  • 89
  • 135

1 Answers1

0

Yes, broadcasting cannot be done from the client side. This is because they may both be sockets but they are not considered the same. Check out these two:

Socket.io-client and Socket.io

ladymalie
  • 168
  • 1
  • 10