I'm building a web chat app using session to keep the time the app last polled so that the server can determine whether messages exist between the current polling time and last polling time. It works well however, there are few instances whereby the messages sent from client A is not received by client B or the same message is produced twice on client B. Of course, the messages are not lost, always stored in the db after they are sent.
I'm wondering, is this related to my usage of session storage whereby the last and current polling time of both clients are always different(due to session data not being accessible by other user/client)? Or should I change to cache storage so that the last and current polling time of both clients to the server are always the same?
p.s. I'm using Apache server and MySQL though with AJAX setTimeout() function to poll the server at regular intervals.