Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offline support? #1

Open
khrizt opened this issue Sep 1, 2016 · 1 comment
Open

Offline support? #1

khrizt opened this issue Sep 1, 2016 · 1 comment
Labels

Comments

@khrizt
Copy link

khrizt commented Sep 1, 2016

Hi,

I've seen this today on reddit and looks like a great project, does it have or will have sometime offline support for messages?

Thanks,
Keep up the good work!

@OmarElgabry
Copy link
Owner

This already is almost done by Socket.io, but, there are pitfalls.

If two users are chatting together; userA and userB. If userA lost the internet connection, the socket will detect there is a disconnection and will try to reconnect when the connection is up again. Now, any messages that will be sent by userA will be buffered and transmitted to all other active sockets when it's possible.

The problem is, any messages that will be sent by userB during the disconnection, won't be delivered to userA after reconnecting successfully, Why? On re-connection, a new socket will be created, with a new id, and will join the room again, and when userB tried to send messages to all active sockets while userA was disconnected, the newly created socket(created after re-connection) wasn't included across active sockets.

The solution might be for userA has to ask for the messages sent by all users in the chatroom while disconnection. Therefore, the messages has to be stored somewhere for later fetching.

For this chat application, I don't store messages, So, it's hard to achieve this, but, can be implemented in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants