Browse Source

Listen to channel

pull/1/head
Nafies Luthfi 5 years ago
parent
commit
28a21b713d
  1. 6
      public/js/app.js
  2. 2
      public/js/jquery-3.5.1.min.js
  3. 7
      resources/js/bootstrap.js
  4. 9
      resources/views/welcome.blade.php
  5. 4
      routes/channels.php

6
public/js/app.js

@ -25392,9 +25392,13 @@ window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
forceTLS: false, forceTLS: false,
wsHost: window.location.hostname, wsHost: window.location.hostname,
wsPort: 6001, wsPort: 6001,
disableStats: true
disableStats: false
}); });
Pusher.log = function (message) {
window.console.log(message);
};
/***/ }), /***/ }),
/***/ "./resources/sass/app.scss": /***/ "./resources/sass/app.scss":

2
public/js/jquery-3.5.1.min.js
File diff suppressed because it is too large
View File

7
resources/js/bootstrap.js

@ -27,5 +27,10 @@ window.Echo = new Echo({
forceTLS: false, forceTLS: false,
wsHost: window.location.hostname, wsHost: window.location.hostname,
wsPort: 6001, wsPort: 6001,
disableStats: true
disableStats: false
}); });
Pusher.log = function(message)
{
window.console.log(message)
}

9
resources/views/welcome.blade.php

@ -97,8 +97,15 @@
</div> </div>
</div> </div>
</body> </body>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="{{ asset('js/app.js') }}"></script>
<script src="{{ asset('js/jquery-3.5.1.min.js') }}"></script>
<script src="{{ asset('js/plugins/noty.js') }}"></script> <script src="{{ asset('js/plugins/noty.js') }}"></script>
<script>
Echo.channel('queue-notifier')
.listen('.App\\Events\\LongRunJobDone', (e) => {
console.log(e);
});
</script>
@if (Session::has('flash_notification.message')) @if (Session::has('flash_notification.message'))
<script> <script>
noty({ noty({

4
routes/channels.php

@ -16,3 +16,7 @@ use Illuminate\Support\Facades\Broadcast;
Broadcast::channel('App.User.{id}', function ($user, $id) { Broadcast::channel('App.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id; return (int) $user->id === (int) $id;
}); });
Broadcast::channel('queue-notifier', function ($user, $id) {
return true;
});
Loading…
Cancel
Save