socket.io emits multiple times

后端 未结 3 1699
天命终不由人
天命终不由人 2021-01-04 06:53

I have got a very basic example. This question has been asked previously multiple times in stack overflow itself but I could not get the right answer so I am going with this

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-04 07:33

    For the Client Side you can use socket.once() instead of socket.on() Ex -

    socket.once('result', function(data){
     console.log('The data is '+data)
    })
    

提交回复
热议问题