In our web application, we used websocket to receive notification messages on the client (web browser). Recently, we see a very strange problem:
When we restarted the push-server, web browser started receiving old notification messages (that have been received before) on the new websocket connection. Yet, the push server didn't send anything after being restarted. And we further confirmed this by capturing packets on the client machine - there were no incoming packets from the push server. We suspect caching is at work, and clear the browser cache, now the problem cannot be reproduced. My speculation is: when the browser detects a broken websocket connection (the push server does not end the connection gracefully when being restarted), it caches old messages received on this connection, and fake re-sending them when a new connection is established to the push server.
My question is:
-
What is the mechanism of browser caching and re-sending websocket messages? Is this part of websocket protocol?
-
Is there a switch/API where I can turn off this caching?
Aucun commentaire:
Enregistrer un commentaire