How to 'restart' sockets immediately?
Hello everyone.
I have an issue that I have been scratching my head over for a couple of days now. I am making an application using the Twitter Streaming API so it constantly streams tweets according to the user's input. Once the user changes the input I want it to update the Twitter feed immediately. I can easily update the search terms on the API but when I do that the feed keeps showing the tweets from the previous search terms and I think it may be caused by my socket.io connection. So I want to be able to cut off the connection to all the sockets and restart them again immediately or something similar to achieve what I want to happen. Just want to know how to do this or some ideas of how to do this?
My socket.io connection is initialised like so: var express = require('express'); var app = express(); var http = require('http').Server(app); var io = require('socket.io')(http);
Any suggestions or ideas are appreciated. If you want some more of my code for explanation or need me to expand on what I require then please let me know and I will do so.
Thank you.
You can use disconnect method on the socket and the connect again
What @ggrav suggested should work.