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
Post a Comment