pushinbr / pam-socket
Expressive socket API for Pam WebSockets.
Requires
- php: ^8.4
- pushinbr/pam-contracts: ^1.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v1.1.0
- v1.0.2
- v1.0.1
- v1.0.0
- v0.1.47
- v0.1.46
- v0.1.45
- v0.1.44
- v0.1.43
- v0.1.42
- v0.1.41
- v0.1.40
- v0.1.39
- v0.1.38
- v0.1.37
- v0.1.36
- v0.1.35
- v0.1.34
- v0.1.33
- v0.1.32
- v0.1.31
- v0.1.30
- v0.1.29
- v0.1.28
- v0.1.27
- v0.1.26
- v0.1.25
- v0.1.24
- v0.1.23
- v0.1.22
- v0.1.21
- v0.1.20
- v0.1.19
- v0.1.18
- v0.1.17
- v0.1.16
- v0.1.15
- v0.1.14
- v0.1.13
- v0.1.12
- v0.1.11
- v0.1.10
- v0.1.9
- v0.1.8
- v0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- dev-brand/pam-mascot
- dev-docs/readme
This package is auto-updated.
Last update: 2026-11-09 16:13:17 UTC
README
Rooms, broadcasts, acknowledgements, and scale-out over native WebSockets.
An event-oriented API over PAM's RFC 6455 transport with authentication, bounded events, rooms, resume behavior, and Redis Streams/NATS adapters.
Install · Quick example · API · Docs · Issues
Install
Create a realtime application with the --socket flag:
pam init realtime-api --template http --socket
cd realtime-api
pam dev
For Laravel, use pam init realtime-laravel --template laravel --socket. In an existing project, use pam composer require pushinbr/pam-socket. Run pam doctor after dependency changes and before creating a release.
Quick example
<?php declare(strict_types=1); use Pam\App; use Pam\Http\Request; use Pam\Http\Response; $app = new App; $socket = \Pam\Socket\Server::create(); $socket->on('connection', static function (\Pam\WS\Socket $client): void { $client->emit('welcome', ['message' => 'Connected to Pam Socket']); }); $app->get('/api/ping', static fn (Request $request, Response $response): Response => $response->json([ 'message' => 'pong', ])); $app->listen((int) (getenv('PAM_PORT') ?: 3000));
What you can build
- Chat, presence, and collaboration
- Realtime dashboards and notifications
- Multi-worker broadcasts coordinated through Redis Streams or NATS
| Role | Realtime framework |
| Execution path | PAM WebSocket transport · PHP event API |
| This repository owns | Application events, rooms, acknowledgements, and broadcast adapters |
| Boundary | Not wire-compatible with Socket.IO or Engine.IO clients |
API guide
| Surface | Use it for |
|---|---|
Server::create() |
Create the event layer over PAM's native WebSocket server. |
on() |
Handle connection and application events. |
auth() |
Authenticate the connection before application events are accepted. |
emit() |
Broadcast an event to connected clients. |
to() |
Target a room through a RoomEmitter. |
adapter() |
Coordinate broadcasts across workers through supported Redis Streams or NATS adapters. |
PAM Socket uses standard RFC 6455 frames and its own event envelope. It is not an Engine.IO or Socket.IO server. Clients must implement the documented PAM event contract, acknowledgement identifiers, reconnect policy, and resume behavior.
Production checklist
- Keep request data and mutable state scoped to the current request.
- Test success, validation failure, exception, cancellation, and timeout paths.
- Configure explicit limits and avoid unbounded payloads, queues, or retained collections.
- Run
pam doctor,pam test, and the relevant integration suite before release. - Validate real dependencies and workload behavior; compatibility is not inferred from package installation alone.
Troubleshooting
- Class not found: run
pam composer install, verify PSR-4 configuration, and rerunpam doctor. - Behavior differs over the network: reproduce with PAM's transport integration tests; in-memory execution does not model the socket boundary.
- A dependency blocks a worker: use PAM-native I/O, a compatible event loop, a process pool, or additional isolated workers.
Report security vulnerabilities through GitHub private vulnerability reporting or the PAM security policy, not a public issue.
Docs
Part of the PAM ecosystem
PAM runs PHP natively on servers, desktops and phones. This repository is one piece of it.
| PAM | PAM Desktop | PAM Native | Ecosystem |
|---|---|---|---|
| the runtime and CLI | native desktop apps in PHP | native Android and iOS apps in PHP | every official package and plugin |
Docs: push-in.github.io/pam-docs · Issues
Apache License 2.0: use, modify and distribute for any purpose, including commercially · Made in Brazil by Pushin