When a chatroom is rendered for display, the backend generates a channel token for the current user and sends the user online notification to other users. I have discovered two potential issues with this:
- When the page is served from cache, e.g. for anonymous users, the content token is never generated and so the user is unable to join the channel and receive messages from it.
- The user online notification is sent too early in the process, before the user actually connects. As a result, the user may appear as online even if they fail to connect for some reason.
I think a possible solution would be to initiate an ajax call from the frontend to request the channel token and trigger the online notification. This way, caching won't be an issue, and the user will only appear online when they are actually connected.
Comments
Comment #2
Anonymous (not verified) commentednice idea, looking forward to it.
Comment #3
glekli commentedThis update has been committed here:
http://cgit.drupalcode.org/chatroom/commit/?id=17c61de