Joining socket io room on connect

后端 未结 3 1889
别跟我提以往
别跟我提以往 2021-02-05 04:55

I am trying to make a logged in user to join a certain socket.io room on connect. According to any examples I found on the net I seem to have emit some action from client to be

3条回答
  •  佛祖请我去吃肉
    2021-02-05 05:24

    There is no .join() method on the client side. Rooms are purely a server-side construct and the client knows nothing about them.

    Your first block of code is the desired way to do things. You send the server a message of your design asking it to join the socket to a room and the .join() is executed on the server side.

提交回复
热议问题