15 March 2026 php
Cara Connect Pusher JS ke Laravel Reverb
Untuk menghubungkan pusher di client ke server reverb, kita tetap bisa menggunakan library pusher-js, dengan tambahan beberapa properti, yaitu:
wsHost: host server reverbwsPort: port server reverb
Contoh:
import Pusher from 'pusher-js'
const REVERB_APP_KEY = '302310231'
const REVERB_HOST = 'localhost'
const REVERB_PORT = 8080
const pusher = new Pusher(REVERB_APP_KEY, {
cluster: '',
wsHost: REVERB_HOST,
wsPort: REVERB_PORT
})
Untuk mencoba di lokal, biasanya tidak perlu menggunakan TLS, maka bisa dinonaktifkan dengan forceTLS: false .
import Pusher from 'pusher-js'
const REVERB_APP_KEY = '302310231'
const REVERB_HOST = 'localhost'
const REVERB_PORT = 8080
const pusher = new Pusher(REVERB_APP_KEY, {
cluster: '',
wsHost: REVERB_HOST,
wsPort: REVERB_PORT,
forceTls: false
})