echo
echo copied to clipboard
Connecting to presence channel problem
Hello, I have a problem with connecting to presence channel:
Laravel console:
L A R A V E L E C H O S E R V E R
version 1.6.2
⚠ Starting server in DEV mode...
✔ Running at localhost on port 6001
✔ Channels are ready.
✔ Listening for http events...
✔ Listening for redis events...
Server ready!
OWCJjy4o64iDbqMOAAAA joined channel: public_channel
Preparing authentication request to: http://localhost/app/public/index.php/api/v1
Sending auth request to: http://localhost/app/public/index.php/api/v1/broadcasting/auth
- Preparing authentication request to: http://localhost/app/public/index.php/api/v1
- Sending auth request to: http://localhost/app/public/index.php/api/v1/broadcasting/auth
- Preparing authentication request to: http://localhost/app/public/index.php/api/v1
- Sending auth request to: http://localhost/app/public/index.php/api/v1/broadcasting/auth
- OWCJjy4o64iDbqMOAAAA authenticated for: private-private-channel
- OWCJjy4o64iDbqMOAAAA joined channel: private-private-channel
- OWCJjy4o64iDbqMOAAAA authenticated for: presence-presence-channel.1
-
Unable to join channel. Member data for presence channel missing ************************Here*********************
- OWCJjy4o64iDbqMOAAAA joined channel: presence-presence-channel.1
Laravel channels.php:
Broadcast::channel('private-channel.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
});
Broadcast::channel('presence-channel.{id}', function ($user, $id) {
return ['id'=>$id,'user'=>$user->name];
});
Laravel BroadcastServiceProvider:
public function boot()
{
Broadcast::routes(['middleware' => ['auth:sanctum']]);
require base_path('routes/channels.php');
}
Dart code:
echo!.join('presence-channel.1').here((users) {
logger.e(jsonEncode(users));
}).joining((user) {
logger.e(jsonEncode(user));
}).leaving((user) {
logger.e(jsonEncode(user));
}).listen('presence-channel PresenceEvent: ', (e) {
logger.e(e);
});
Up
did u used it in paid host ?
did u used it in paid host ?
No, just trying locally
@a7mdragab Did you resolve it? I have the same trouble.