wyatts97/flarum-chatroom

A real-time chatroom extension for Flarum v2.x

Maintainers

Package info

github.com/wyatts97/flarum-chatroom

Language:TypeScript

Type:flarum-extension

pkg:composer/wyatts97/flarum-chatroom

Statistics

Installs: 21

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.3.7 2026-05-24 03:52 UTC

This package is auto-updated.

Last update: 2026-05-24 04:02:24 UTC


README

A real-time chatroom extension for Flarum v2

Features

  • Mithril Frontend — Built with TypeScript and Mithril JSX components.
  • JSON:API Backend — Full Flarum JSON:API integration with proper serializers.
  • MySQL Storage — Messages stored in a dedicated chat_messages table.
  • Logged-in Only — Chatroom accessible only to registered users.
  • Polling MVP — Configurable polling interval for live message updates.
  • Websocket-Ready — Event architecture (ChatMessagePosted) ready for Pusher/WebSocket integration.
  • Modern Responsive UI — Mobile-friendly design with auto-scroll and clean aesthetics.
  • Flood Control & Limits — Configurable rate limiting, max message length, and history limit.

Requirements

  • PHP >= 8.2
  • Flarum >= 2.0.0-rc.1
  • MySQL / MariaDB

Installation

composer require wyatts97/flarum-chatroom
php flarum migrate
php flarum cache:clear

Build Frontend

cd js
npm install
npm run build

Admin Settings

  • Polling interval — How often to poll for new messages (ms).
  • Flood control — Minimum seconds between messages from the same user.
  • Max message length — Character limit per message.
  • Message history limit — How many messages to load at once.

API Endpoints

Method Endpoint Action
GET /api/chat/messages List messages
POST /api/chat/messages Send message
DELETE /api/chat/messages/{id} Delete message

WebSocket Upgrade Path

The ChatMessagePosted event is dispatched on every new message. To switch from polling to WebSocket:

  1. Listen to ChatMessagePosted in a service provider.
  2. Broadcast the payload via Pusher, Ably, or Laravel Echo.
  3. On the frontend, replace the setInterval polling in ChatPage.tsx with a WebSocket subscription.

License

MIT