Question

I'm building a live chat using JSJaC and ejabberd . It's all working except that all site visitors are given the account 'guest'. If two visitors try to livechat at the same time the responses get muddled or the first user is logged out.

I can randomly set the guest name but then I need to check whether that name is registered or auto-register and hope it hasn't been registered before. I tried assigning each login to a random resource name but this still merged the conversations.

In short i'm looking for the easiest way to allow multiple anonymous logins to start individual conversations with the livechat account. Even better (but optional) if the livechat could round-robin to a different user when the primary livechat account is in a chat.

The solution can be web-client or server based, I don't care since I control both (and ejabberd supports various modules).

BTW, when I try to auto-register a registered account the JSJaC simpleclient demo returns:

An error occured:
Code: 409
Type: cancel
Condition: conflict

I haven't established yet if this is something I can ignore or override with a custom client or server setup. I suppose I could just detect this error and try again without auto-register but I'd like to hear better/easier options.

Was it helpful?

Solution

Try enabling anonymous login mode on your ejabberd server? Then you don't have to register the client accounts, just pick any random username and password and ejabberd should accept them...

OTHER TIPS

I guess you can use external authentication in ejabberd I'm in the same situation: I want anonymous users to be able to login in the server, but some special users also be able to login for adiminstrative tasks... So I decided to write a php script as an authentication handler for ejabberd. Then it will accept all logins with the name starting with anon_* and authenticate other users against a database.

We had a similar issue in a project - we wanted users to be able to login without requiring any account creation or clashes - auto-registration would not work for us because names could clash. In the end we chose anonymous login with SASL authentication in ejabberd - it allows anonymous login and dynamic account creation and I believe the accounts do not stay on the system (they are alive only whilst the connection is open), however from what I remember the server will generate a random ID for the user.

The GUID JID problem might be able to be solved with the use of Nicknames

Set up SASL

Ejabberd Support Page - SASL

If you can't get ejabberd's anonymous mode working, you might try creating a GUID for each user's base name, and just registering the user on the fly. You'll want to have a periodic script that deletes old unused accounts from the database.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top