@Constantine1

Как использовать pusher в laravel 5.4?

При попытке отправить сообщение Laravel возвращает исключение: BroadcastException in PusherBroadcaster.php line 106:
404 NOT FOUND.

Event:

<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class TestEvent implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public $text;
    public function __construct($text)
    {
        $this->text=$text;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return Channel|array
     */
    public function broadcastOn()
    {
        return new PrivateChannel('channel-name');
    }
}


Роуты:

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

use App\Events\TestEvent;

Route::get('/', function () {
    return view('welcome');
});

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');

Route::get('/broadcast', function() {
    event(new TestEvent('Test message'));

    return view('welcome');
});


пакет pusher-php-server добавлен.
в .ENV добавлены переменные
в config/broadcasting добавлены app_id, key, secret.
также добавлен BroadcastServiceProvider.

Подскажите, в какую сторону смотреть?
  • Вопрос задан
  • 704 просмотра
Пригласить эксперта
Ответы на вопрос 1
@Constantine1 Автор вопроса
в целом я все напутал. Вместо имени переменной написал ключи pushera.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы