Laravel-websockets: How to use pusher HTTP API with pusher replacement?

Created on 13 Aug 2020  路  4Comments  路  Source: beyondcode/laravel-websockets

Is there a way to know who people subscribed in presence channel from backend with pusher replacement using HTTP-api for pusher

https://pusher.com/docs/channels/server_api/http-api#querying-application-state

All 4 comments

You can determine by connection if you are using the \BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManager. It is already injected in the container.

You can use $channelManager->getChannels($appId) and find out the channels and who's subscribed to.

@rennokki Where can I find it in the docs? Can you send me a link or an example?

Basically, when somebody connects or disconnects to various channels, they are being stored by default in https://github.com/beyondcode/laravel-websockets/blob/master/src/WebSockets/Channels/ChannelManagers/ArrayChannelManager.php

As you can see, it implements the ChannelManager interface and is resolved in the container.

It now depends where you want to retrieve this data. You can retrieve it only within the Websocket command's container, which I think it's inconvenient.

@rennokki thank you so much :+1:

Was this page helpful?
0 / 5 - 0 ratings