저는 Pusher와 Laravel Echo를 처음 사용하고 단계별로 학습했습니다. 내 새 프로젝트에서 구현하려고하지만 어떻게 든이 푸셔 라이브러리가 Laravel Echo와 어떻게 작동하는지 이해할 수 없습니다.Pusher가 Laravel 5.3에 메시지를 표시하지 않습니다.
내가하고있는 일은 관리자 등록에서 내가 한 일이 맞는지 아닌지를 확인하기 위해서입니다. 디버거 콘솔의 내 푸시 대시 보드 계정에서 내가 생성 한 이벤트의 출력이 무엇인지보고 싶을뿐입니다.
나는 follwing을 내용으로 이벤트 AdministratorGenerated
을 만들었습니다 bootstrap.js 파일에서
class AdministratorGenerated implements ShouldBroadcast
{
use InteractsWithSockets, SerializesModels;
public $user;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;
}
/**
* Get the channels the event should broadcast on.
*
* @return Channel|array
*/
public function broadcastOn()
{
//return new PrivateChannel('administrator');
// To send it as public channel to pusher
return['administrator'];
}
}
을, 내가 가진 :
import Echo from "laravel-echo"
window.Echo = new Echo({
broadcaster: 'pusher',
key: 'my-pusher-key',
cluster: 'ap1',
encrypted: true
});
window.Echo.channel('administrator')
.listen('AdministratorGenerated', (e) => {
console.log(e);
});
성공적으로 양식을 등록, 나는 이벤트
을 발사하고event(new AdministratorGenerated($registeredUser));
이 이벤트는 환영 이메일을 보내고 def ault 계정.
편집 : 1 : 여기
가 .env
파일의
하지만, 내가 미는 대시 보드 디버그 콘솔로 이동, 내가 보게 모두는 다음과 같다 :
APP_ENV=local
APP_KEY=base64:toktfSBbJM0vbylxhT/zHXOi7zVga9jsliB/mtE96HY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=larammerce_v1
DB_DATABASE_TESTING=larammerce_v1_testing
DB_USERNAME=root
DB_PASSWORD=root
BROADCAST_DRIVER=pusher
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=database
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
# All of the below values are correct
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=null
# All of the below values are correct
PUSHER_APP_ID=id
PUSHER_KEY=key
PUSHER_SECRET=secret
그리고 여기에는 broadcasting.php
설정 파일
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'pusher'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_KEY'),
'secret' => env('PUSHER_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => 'ap1',
'encrypted' => true
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];
내가 뭐하는 거지하는 실수는 무엇입니까? 아무도 나를 도와 줄 수 없나요?
미리 감사드립니다.
이미지에서 볼 수있는 것과 똑같은 것을 나에게 다시주었습니다 ... 심지어 변경 사항을 수행 한 후에도 ... –
어떤 대기열 드라이버를 사용하고 "푸셔/푸셔 -php- 서버 "와 작곡가? –
질문을 수정했습니다. 친절하게 그것을 봐 ... –