I use redis on laradock, and passport to authenticated channel. if i use public channel, socket is connected, but if i modify channel event in NewMessage.php to private, i get error Error sending authentication request
when trying to authenticate . anyone have same problem? how to resolve it?
laravel-echo-server.json configuration:
{
"authHost": "http://platform.lenna.test/app/public",
"authEndpoint": "/broadcasting/auth",
"clients": [],
"database": "redis",
"databaseConfig": {
"redis": {
"port": "6379",
"host": "redis"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "http",
"socketio": {},
"sslCertPath": "",
"sslKeyPath": "",
"apiOriginAllow": {
"allowCors": true,
"allowOrigin": "http://localhost:80",
"allowMethods": "GET, POST",
"allowHeaders": "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id"
}
}
this is my laravel event NewMessage.php
...
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class NewMessage implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $message;
public $app;
public $room;
public function __construct(Message $message, Room $room, App $app)
{
$this->message = $message;
$this->app = $app;
$this->room = $room;
}
public function broadcastOn()
{
return new PrivateChannel('ChannelApp.' . $this->app->id);
}
}
BroadcastServiceProvider.php
class BroadcastServiceProvider extends ServiceProvider
{
public function boot()
{
Broadcast::routes(['middleware' => ['auth:api']]);
require base_path('routes/channels.php');
}
}
Channel.php routes
Broadcast::channel('ChannelApp.{appId}', function ($user, $appId) {
return true;
})
This is my laravel-echo-server error logs:
127.0.0.1
with port80
and he's not answering your request. So this can have 1000 reasons and to debug this you need to post every related code you have. It should be clear that nobody can help you with such a common error message and so little code you've posted! First check that the metnioned host and port is correct. Then check every log file if there are more informations. - thmspl