Пытаюсь подключить laravel echo.
laravel-echo-server
{
"authHost": "http://want_can.lc",
"authEndpoint": "/broadcasting/auth",
"clients": [],
"database": "redis",
"databaseConfig": {
"redis": {
"port": 6379,
"host":"127.0.0.1",
"keyPrefix":null
},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "http",
"socketio": {},
"secureOptions": 67108864,
"sslCertPath": "",
"sslKeyPath": "",
"sslCertChainPath": "",
"sslPassphrase": "",
"subscribers": {
"http": true,
"redis": true
},
"apiOriginAllow": {
"allowCors": false,
"allowOrigin": "",
"allowMethods": "",
"allowHeaders": ""
}
}
вот bootstrap
if (typeof io !== 'undefined') {
window.Echo = new Echo({
broadcaster: 'socket.io',
host:window.location.hostname +":"+ '6001',
//transports: ['websocket', 'polling', 'flashsocket'],
});
}else{
console.log('AAA!')
}
вот событие
<?php
namespace App\Events;
class PrivateChat implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $data;
public $user;
public function __construct($data,User $user)
{
$this->data=$data;
$this->user=$user;
$this->dontBroadcastToCurrentUser();
}
public function broadcastOn()
{
Message::create($this->data,$this->user);
return new PrivateChannel('room.'.$this->data['room_id']);
}
}
вот контролер
<?php
class MessageController
{
public $service;
public function __construct(ChatroomService $service)
{
$this->service=$service;
}
public function message(ChatRequest $request,User $user)
{
event ( new PrivateChat($request->all(), $user));
}
}
вот каналы
Broadcast::channel('room.{room_id}', function ( $user, $room_id) {
return $user->chatroomsCustomer->contains($room_id)||$user->chatroomsExecutor->contains($room_id);
});
запускаю laravel-echo-server
запускаю очередь захожу на страницу отрываю консоль вкладка network
те сокеты не получает sid.
в socket-echo-server в консоле получаем
Channel: private-room.1
Event: App\Events\PrivateChat
вот что получаю в очереди
[2021-02-01 06:50:25][RXvfnlILeDt6J2MTWAXPA9EStl1Cgi5X] Processing: App\Events\PrivateChat
[2021-02-01 06:50:25][RXvfnlILeDt6J2MTWAXPA9EStl1Cgi5X] Processed: App\Events\PrivateChat
поставил приблуду
https://chrome.google.com/webstore/detail/laravel-... она подключается