Show Online Chat Users on Homepage

Ok, quite simply, I want to know how to display both the users in chat and the sum total on the homepage and Members|Online pages.

 

Now, I've only heard murmurings of doing this and some people have at least determined the database table RayChatCurrentUsers is key.  I think that much is probably true.

 

I've learned a few things so far.  Table RayChatCurrentUsers does contain some entries for chat users.  This table doesn't flush some of the entries of users who logged out weeks or months ago.  So you can maybe overcome this by restricting results using the timestamp for the field "when."  This opens up several more cans of worms, but we can worry about that a little later.

 

Additionally, I'm beginning to believe that there's a separate database on the RMS server if you use an RMS?  When I have my offsite RMS enabled, the RayChatCurrentUsers table seems to remain unchanged.  If I disable my RMS, then the table will update a user entry when the user enters the chatroom.

 

Now, on the assumption that the RMS does have it's own database, I need to figure out how to connect to it in my test script.  Looking in the ray/modules/global/inc folder you'll find a db.inc.php file that has the key "mysql_connect" call.  The structure of the file is very similar to the Dolphin's general inc/db.inc.php file.  And all the database connection details (server, port, username, password, etc.) are stored for Dolphin in the header.inc.php file.  However, the ray/modules/global/inc/header.inc.php file does reference some "$db['host']", etc. but it's never defined.

 

As the Ray php files don't have specific include statements, I haven't been able to track down where "$db['host']", "$db['passwd']", etc. are defined for Ray.  Of course, at some point the host and port are read in through the Admin Panel configuration settings, but I can't find that code either.  Presumably the username and password are blank or some sort of generic since it doesn't need to be specified for setting up the RMS.  The RMS handles authentication by simply only allowing connections from a specific domain, and nothing else.

 

I tried to hack/divine what the 6 connection parameters were by inserting this code:

$myFile = "/[path to some directory]/someOutputFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");

fwrite($fh, DB_HOST);
fwrite($fh, "\n");
fwrite($fh, DB_PORT);
fwrite($fh, "\n");
fwrite($fh, DB_SOCKET);
fwrite($fh, "\n");
fwrite($fh, DB_NAME);
fwrite($fh, "\n");
fwrite($fh, DB_USER);
fwrite($fh, "\n");
fwrite($fh, DB_PASSWORD);
fwrite($fh, "\n");
fclose($fh);

 

just before the line:

$oDb = new BxDbConnect(DB_HOST, DB_PORT, DB_SOCKET, DB_NAME, DB_USER, DB_PASSWORD);
$oDb->connect();

 

in ray/modules/global/inc/db.inc.php.  I was expecting that the next time a user entered chat, the Ray system would connect to the database and trigger this debug code.  Rather strangely, it never ran (or the output never occurred) when a user connected to chat either with or without the RMS enabled.

 

So I'm out of ideas of how to figure this out and get it working.

Quote · 6 Feb 2010

Ok, I've done some more testing today and learned a few things.

 

Database only used for non-RMS Mode (XML Mode)

I tracked down the ray/modules/chat/inc/actions.inc.php where some of the actual SQL queries are performed on RayChatCurrentUsers (MODULE_DB_PREFIX . "CurrentUsers`).  I inserted this debug code into it at the top:

 


$myFile = "pathtodir/outputFile.txt";
$fh = fopen($myFile, 'a') or die("can't open file");

fwrite($fh, 'Debug from RayChat\n');

fwrite($fh, DB_HOST);
fwrite($fh, "\n");

fwrite($fh, $sAction);
fwrite($fh, "\n\n");

fclose($fh);

 

 

Now, when a user entered chat with RMS enabled, the following case statements were triggered in action.inc.php:

  • getSkins
  • getPlugins
  • getLanguages
  • userAuthorize
  • config
  • getSmileSets
  • getSounds

So pretty much boring stuff to authenticate and get the user interface ready for chat.  It doesn't touch the database at all.

 

I tried disabling the RMS and seeing the results:

  • getSkins
  • getPlugins
  • getLanguages
  • userAuthorize
  • config
  • getSmileSets
  • getSounds
  • getOnlineUsers
  • getRooms
  • enterRoom
  • update
  • update
  • update (runs several times a minute)
  • ...
  • exitRoom
  • update...

Ah, ok, so much more interesting functions that actually use the database.  And sure enough, look at the RayChatRoomUsers and RayChatCurrentUsers table reveals they get updated (more or less).

 

Looking more closely at the code comments, this is evidently called "XML Mode" in Red5 (the basis of Ray).  So, without an RMS, it sends messages to some combination of the database and an XML file and periodically reads updates in and sends them out.  It also tracks rooms and online users this way, the way you'd expect an HTML based chat to run.

 

The problem is that this debug code also reveals that the "DB_HOST" is set to "localhost" whether you use the RMS or not.  So I'm beginning to think the RMS doesn't have a seperate database - the database is only used in XML mode when there is no RMS enabled. Frown 

 

Soooo, that means Ray may not publish the online user list in an easily accessible way? Yell  I really need this to boost site activity, and I have a feeling many other sites would benefit too.

 

Possible Solutions

I'm having a couple ideas.  Well, preferibly someone in the know could key me in on where this data is passed in Red5/Ray and maybe we could write a widgit or some interface so we can get this data on the homepage and online users page.

 

Or, failing that, maybe there's some way to enable parts of the XML mode so it will refresh online user data in the database even when using the RMS?

 

Quote · 8 Feb 2010

I'm being asked for this as well...

Quote · 10 Feb 2010

Is there anyone who would help if money were involved?

Quote · 12 Feb 2010

Well, I had just found these mods, though I have a feeling Rayz's is the only ones properly done.  I suspect the other two just load in the database table information, which is wrong, while many of Rayz's mods actually use Shockwave.

 

http://www.expertzzz.com/Downloadz/view/3890

 

http://www.expertzzz.com/Downloadz/view/4969

 

http://www.expertzzz.com/Downloadz/view/5541

 

But I guess I'll never know because I was just going to buy Rayz's today. I've seen it in action, and at the very least it does show the number of online chat users on the homepage - I'm not sure if it will actually export to the database so I can show the individual user icons in Members|Online.  It's maybe not all I want, but it's a good start.

 

Well, it's done, Expertzzz is now read-only, it won't take my money. Yell Yell It's so frustrating when you're willing to throw money at a problem and people won't take it.  I should have bought it as soon as I found it.

 

I'll try pming Rayz to see if he'll put it on Unity.  I hope so, as I really need this and I think he's a quality programmer, and I can't afford to take the time to upgrade to version 7 either, as many authors have stopped publishing their version 6 stuff. Frown

Quote · 12 Feb 2010

Heh, perhaps I'm a little impatient, but I just had to dig some more as this problem is really important to me.

 

So I'd read about Trac yesterday, and wasn't even aware they had a wiki like that.  I was looking at the Devlopment and Documentation page and got really excited when I read "Full access to 100% of Dolphin source code, including Flash apps, older versions and upcoming versions."  Whoo hoo, I don't know much about Shockwave yet, but I figured it might give some insight to things.

 

I'll be darned if I can find the swf source though.  I can only seem to find the swf files themselves.  Anyone know where it is?

Quote · 12 Feb 2010

I'm still on 616 and I'd really love to figure out how to show the current chat users right next to the chat link on the main menu.

Example: Chat (55)

Have you made any progress on this?

Taking Dolphin and Making Profitable Websites Since 2009 :)
Quote · 10 Apr 2010

I could be totally wrong, but I think when using RMS Red5 stores the information in some kind of memory array that is some how accessible through the 'flash app' interface.

Light man a fire keep him warm for a night, light him ON fire & he will be warm the rest of his life
Quote · 2 Jun 2010

Has anyone found a solution for this?

Quote · 19 Jan 2011

Is this what you are looking for?

 

http://www.boonex.com/unity/extensions/entry/Chat_Summary/

Nothing to see here
Quote · 19 Jan 2011

Wow thanks - and only $10 bucks :)

Just my luck - the shopping cart seems to be down.

Quote · 19 Jan 2011

Ah crap, now my chat's not working.  The other RMS module work, just not chat.

 

 

Quote · 19 Jan 2011

Wow - Rayzz fixed it that fast.  How great is that support?

Quote · 20 Jan 2011
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.