[Solved] Exchange messages with non-logged user

I want chat with a user that has trouble logging into the application (e.g. user had 3 times a “wrong password” issue). The chat may not be in real time (e.g. after attending all higher priority support issues, our support person contacts the user to see if they are still having issues).

Because the user is not logged in and the communication is not synchronous, I don’t know how to implemement said chat.

In a “logged” setting I would have just kept a collection of messages per user on the server side which I would have synchronized with the corresponding customer via a query. But here I don’t know what to do.

Hmm, you can check Meteor.server.sessions on the server to find all active sessions. There you can find the IP address of the client, and use that as a “user ID” for the chat :slight_smile:
(You could also use the session ID I guess, but that might change if the user reloads the page).

1 Like

Check this out. Works great, easy to use. You can create a “guest user”, which will give you a Meteor user _id.

Now you can have their client init a chat with your database.

1 Like