Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Shahryar's avatar

Websocket connection handler for laravel reverb

How can I get which user joined or left from channel in laravel reverb.

I know how to do this in javascript with echo (frontend), but I need to access onOpen,onClose,... events in laravel itself (backend).

something like BeyondCode Custom WebSocket Handlers.

any suggestion? thanks.

0 likes
2 replies
Shahryar's avatar
Shahryar
OP
Best Answer
Level 1

I did this by extending the Server class in Reverb. :)

naikerwong's avatar

@Shahryar I am facing a similar issue as well. I have also tried to extend the Laravel\Reverb\Servers\Reverb\Http\Server class. However, using the extended Server Class requires us to modify/override the php artisan reverb:start(StartServer) command since that is where the Server has been generated. May I ask how your implementation works?

Please or to participate in this conversation.