How do you stop listening to a socket.io channel? -


in socket.io, can bind socket event/channel this:

<script src="/socket.io/socket.io.js"></script> <script> var socket = io.connect('http://localhost');    socket.on('news', function (data) {    console.log(data);    socket.emit('my other event', { my: 'data' });  }); </script> 

but how stop listening "news" event?

try, socket.removealllisteners("news");


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -