Reusable real-time admin chat extension for Nette Framework with WebSocket support (Soketi/Pusher), typing indicators, presence, read receipts, and optional AI responder.

Maintainers

Package info

github.com/JanSuchanek/nchat

pkg:composer/jansuchanek/nchat

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.1.0 2026-03-19 09:59 UTC

This package is auto-updated.

Last update: 2026-04-20 15:29:51 UTC


README

Reusable real-time chat extension for Nette Framework admin panels with WebSocket support (Soketi/Pusher), typing indicators, presence detection, read receipts, emoji reactions, sound alerts, and browser push notifications.

Features

  • ๐Ÿ’ฌ Broadcast + DM + Group chat
  • โšก WebSocket real-time (Soketi/Pusher) with polling fallback
  • โœ๏ธ Typing indicators โ€” "Jan pรญลกeโ€ฆ"
  • ๐Ÿ‘ฅ Online presence โ€” instant online/offline
  • โœ“โœ“ Read receipts โ€” DM delivery confirmation
  • ๐Ÿ˜‚ Emoji reactions โ€” ๐Ÿ‘โค๏ธ๐Ÿ˜‚๐Ÿ˜ฎ๐Ÿ˜ข๐Ÿ™
  • ๐Ÿ”” Sound alerts โ€” Web Audio API ping (toggleable)
  • ๐Ÿ“ข Push notifications โ€” Browser Notification API
  • ๐Ÿค– AI Bot integration โ€” pluggable via AiResponderInterface
  • ๐Ÿ—„๏ธ Database agnostic โ€” ChatStorageInterface (DBAL included)

Installation

{
    "repositories": [
        {"type": "vcs", "url": "git@gitlab.com:JanSuchanek/nchat.git"}
    ],
    "require": {
        "jansuchanek/nchat": "dev-main"
    }
}

Configuration

extensions:
    nchat: NChat\ChatExtension

nchat:
    websocket:
        host: soketi
        port: 6001
        appId: my-app
        key: my-key
        secret: my-secret
    storage: NChat\Storage\DbalChatStorage  # or your own
    ai:
        enabled: true
        responder: App\Model\MyAiResponder  # implements AiResponderInterface

Usage

Add the trait to any presenter:

final class AdminPresenter extends BasePresenter
{
    use NChat\Presenter\ChatPresenterTrait;
}

Then add chat action names to your allowed actions:

$openActions = array_merge(['dashboard'], self::getChatActionNames());

Custom Database Storage

Implement ChatStorageInterface for any database:

class SqliteChatStorage implements ChatStorageInterface
{
    public function saveMessage(array $data): int { /* ... */ }
    public function fetchMessages(int $userId, array $criteria = []): array { /* ... */ }
    // ...8 methods total
}

Custom AI Responder

class MyAiResponder implements AiResponderInterface
{
    public function respond(string $context): string { /* call OpenAI/Claude/Gemini */ }
    public function getSystemPrompt(): string { return 'You are...'; }
    public function getBotName(): string { return '๐Ÿค– Bot'; }
}

License

MIT