Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet Event Stream doesnt stop after JSP exits  RSS feed

 
aparna bhogu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet which sends HTML5 server sent events to the jsp client. The servlet sends data to the client every one second. The jsp client instantiates a new eventsource and recieves the data. When the window is about to close, the jsp client closes eventsource at the "beforeunload" event (shown in the code below).

However, I have noticed that even after the client closes the eventsource and the browser exits, the server continues sending data. As far as the documentation on eventsource goes, using eventsource.close() is enough to stop client from reconnecting to the server and the server will stop sending any further push notifications.

Can any one please help me understand why the server does not stop sending push notifications even after eventsource.close() and the browser exit? Do I write any other piece of code to notify the server to stop sending data once client exits?

Thank you. Pasted below are the servlet (server ) code and the client code.



Here is the client code:
 
Emanuel Kadziela
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried closing the stream?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!