2017-10-23 25 views
0

Pusher 및 Laravel에 내 알림을 개인 채널에 브로드 캐스팅하려고합니다.Pusher 및 Laravel에 브로드 캐스트 알림에 오류가 있습니다.

내 bootstrap.js처럼 파일

import Echo from 'laravel-echo' 

window.Pusher = require('pusher-js'); 

window.Echo = new Echo({ 
    broadcaster: 'pusher', 
    key: '5c3621c15520b7e2fb02', 
    cluster: 'ap2' 
}); 

Pusher.log = function(message){ 

    window.console.log(message) 
} 

및 콘솔에서

<script> 
    export default { 
     mounted() { 
      this.listen() 
     }, 
     props: ['id'], 
     methods: { 
      listen() { 
       Echo.private('App.User.' + this.id) 
        .notification((notification) => { 
         alert('new notification') 
        }) 
       } 
     } 
    } 
</script> 

내 BroadcastServiceProvider.php 아래처럼 아래

<?php 

namespace App\Providers; 

use Illuminate\Support\Facades\Broadcast; 
use Illuminate\Support\ServiceProvider; 

class BroadcastServiceProvider extends ServiceProvider { 
    /** 
    * Bootstrap any application services. 
    * 
    * @return void 
    */ 
    public function boot() { 

     Broadcast::routes(); 

     Broadcast::channel('App.User.*', function ($user, $userId) { 
      return (int) $user->id === (int) $userId; 
     }); 
    } 
} 

처럼 내 notification.vue 파일 아래에 아래에 같은 오류가 나타납니다

Pusher : State changed : connecting -> connected with new socket ID 334.3086157 
Pusher : No callbacks on private-App.User.1 for pusher:subscription_error 
if I changed BROADCAST_DRIVER=driver 

그것은

Pusher : State changed : connecting -> connected with new socket ID 
Pusher : No callbacks on private-App.User.1 for pusher:subscription_error 

나는이 문제를 어떻게 해결할 수 아래 같은 오류를 준다?

답변

0

전체 코드베이스를 보지 않고 문제의 위치를 ​​정확히 알기는 어렵지만, Pusher 블로그에서 과거에 저에게 도움이 된 전체 프로세스를 안내하는 다음 블로그 포스트를 추천 할 수 있습니다. 도움이

https://blog.pusher.com/how-to-build-a-laravel-chat-app-with-pusher/

희망이!

+0

코드를보고 싶습니다. 편집 해주세요. –