0

I'm making a project with javascript library named SocketIO and I also have a web, with file index.html

So, what I want to do is receive a notification via socket.io client, and every time that I receive a notification refresh the web page.

What I've done until now is receive a notification, nothing else than that.

Here is how I receive a "fire" notification:

// listen and receive fire notification
function fire(socket) {
socket.on('fire', () => {
    console.log('Fire notification received')
})

}

What I want to do is: at the time I receive a notification, refresh the web page (in html).

How can I do it?

Thank you!!!!!

gall indi
  • 1
  • 1
  • It is not clear what are you going to achieve. Please, explain more about the connection between your js project and the web page. How do you execute your js project, and how do you host your web page? Here is about how to refresh the page: https://stackoverflow.com/questions/3715047/how-to-reload-a-page-using-javascript – Anton Pilyak May 18 '18 at 13:03
  • I execute the project with npm start. As you can see in the code I posted, when I receive an event I print 'Fire notification received' at the terminal. So, at the time that I print this message I want to automaticlly refresh the wepage. Thank you! – gall indi May 18 '18 at 14:46
  • ok, then you can try: build a bundle out of your project using webpack, include it in your index.html and the your js code will be executed inside the browser and you will be able to call window.location.reload – Anton Pilyak May 18 '18 at 16:14

0 Answers0