Skip to content

Commit dd5bbf2

Browse files
committed
Now using the nova-echo package to instantiate Echo.
1 parent aac11b6 commit dd5bbf2

File tree

7 files changed

+426
-77
lines changed

7 files changed

+426
-77
lines changed

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"license": "MIT",
1414
"require": {
1515
"php": ">=7.1.0",
16+
"coreproc/nova-echo": "^0.0.1",
1617
"pusher/pusher-php-server": "^3.2"
1718
},
1819
"autoload": {

dist/js/notification_feed.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@
1111
},
1212
"devDependencies": {
1313
"cross-env": "^5.0.0",
14-
"laravel-echo": "^1.5.1",
1514
"eslint": "^4.19.1",
1615
"eslint-config-prettier": "^2.9.0",
1716
"eslint-plugin-vue": "^4.4.0",
1817
"laravel-mix": "^1.0",
1918
"prettier": "^1.14.0"
2019
},
2120
"dependencies": {
22-
"pusher-js": "^4.3.1",
2321
"vue": "^2.5.0",
2422
"vue-infinite-loading": "^2.4.3"
2523
}

resources/js/components/NotificationFeed.vue

+1-18
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
</template>
2121

2222
<script>
23-
import Echo from 'laravel-echo'
24-
25-
window.Pusher = require('pusher-js')
26-
2723
export default {
2824
name: 'NovaNotifications',
2925
props: [
@@ -53,21 +49,8 @@
5349
},
5450
incrementUnreadCount: function () {
5551
this.unreadCount += 1
56-
},
57-
instantiateEcho () {
58-
window.Echo = new Echo({
59-
broadcaster: 'pusher',
60-
key: this.pusherKey,
61-
cluster: this.pusherCluster,
62-
encrypted: true
63-
})
64-
},
65-
},
66-
created () {
67-
if (typeof window.Echo === 'undefined') {
68-
this.instantiateEcho()
6952
}
70-
},
53+
}
7154
}
7255
</script>
7356

resources/js/components/NotificationsPanel.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
})
5656
},
5757
listenForNotifications () {
58-
window.Echo.private(this.broadcastOn)
58+
window.userPrivateChannel
5959
.notification((notification) => {
6060
// Increment the unread count
6161
this.$emit('incrementUnreadCount')
+1-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
<notification-feed pusher-key="{{ env('PUSHER_APP_KEY') }}"
2-
pusher-cluster="{{ env('PUSHER_APP_CLUSTER') }}"
3-
broadcast-on="{{ request()->user()->receivesBroadcastNotificationsOn() }}">
4-
</notification-feed>
1+
<notification-feed></notification-feed>

0 commit comments

Comments
 (0)