1

I am trying to iplement websocket using VUE3 + LARAVEL-ECHO + PUSHER-JS

<script lang="ts">
import { defineComponent, ref, computed, onMounted, onBeforeMount } from 'vue'
import Echo from 'laravel-echo'
declare global {
    interface Window {
        Pusher:any;
        Echo:any;
    }
}
window.Pusher = require('pusher-js');
window.Echo = new Echo({
  broadcaster: 'pusher',
  key: 'mykey',
  cluster: 'mt1',
  secret: 'mysecret',
  wsHost: 'variant.uz',
  wsPort: 6001,
  forceTLS: false,
  disableStats: true,
});
export default defineComponent({
  name: 'MainLayout',
  components: {
  },
  setup () {
    onMounted(()=>{
      window.Echo.listen('EventTriggered','GetRequestEvent', (e:any)=>{
        console.log(e);
      })
    })
    return {}
  }
})
</script>

In the browser dev tools I can see that I connected to the channel, end when event emitted there is also in dev tools Network I see the data sent, but this lines are not triggering

window.Echo.listen('EventTriggered','GetRequestEvent', (e:any)=>{
        console.log(e);
      })
Abror Azimov
  • 11
  • 1
  • 2

0 Answers0