Event-oriented socket APIs for Pam's native WebSocket transport, including authentication, rooms, broadcasts, acknowledgements and Redis Streams/NATS adapters.
pam composer require pushinbr/pam-socketusePam\Socket\Server;
$io = Server::create();
$io->on('connection', staticfn ($socket) => $socket->emit('ready'));Pam uses standard RFC 6455 WebSockets; it is not wire-compatible with Engine.IO or Socket.IO clients.
Free and open-source under the Apache License 2.0. You may use, modify, and distribute this package for any purpose, including commercially.
Create a realtime application with pam init realtime-api --template api --socket or 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. The project remains a normal Composer project with a standard manifest, lockfile, PSR-4 autoloading, and vendor/autoload.php.
| 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. |
| Adapters | 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.
- 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.
- 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.