Overview
The Node.js (Guests) library allows you to run Ajax IM using the included standalone message server. This allows you to support a significantly larger number of users simultaneously without as significant of a server strain. The script requires no database library, as it does not authenticate users; instead, it creates temporary users on the fly as “Guests.”
This library makes use of the Memcache PHP extension, as the Node.js server uses the Memcache API to communicate with external scripts and applications. If you do not have the Memcache library installed in your PHP installation, you will need install it before using this library.
Friends?
The Guests library makes all of the guest users friends of one-another as they connect. Each guest can see all other connected guests; however, they cannot add or remove friends from their buddylist.
login() Function
The login() function creates new guest users and identifies them to the Node.js server. It provides a good example of using some of the Node.js Memcache-based APIs.
If you would like to change the prefix of the guest usernames to something other than “Guest,” change the text between the single quotes on the first line of this function ('Guest' to 'WhateverYouWant'). It is best to stick with alphanumerics sans spaces.
Leave a comment