DEMOS / Comet Chatroom

This page demonstrates how to make a simple chatroom using Comet pools. A Comet pool provides the plumbing for creating multi-user applications in Nitrogen.

Each comet pool has an Erlang term identifier, and can either be local, meaning that it only applies to one user, or global meaning that it applies to all users.

Here, we create a global Comet pool titled 'chatroom'. Anyone who visits this page connects to the same comet pool. Upon clicking the 'Send' button, a message is broadcast to all comet processes that have registered in the pool. The comet process then updates the page with the new message.

Try opening a few different browser windows and chatting with yourself.

View Module Source
Name of chatroom
Copyright © 2008-2024 Nitrogen Web Framework. Released under the MIT License.