[laravel-echo] can't get laravel-echo to work properly with Quasar



  • please help on configuring Laravel-echo with quasar
    what i have done so far:

    • yarn add laravel-echo

    • quasar new plugin laravel-echo

    • add laravel echo on my /quasar.conf.js
      0_1541006120727_laravel echo.png

    • then i configured laravel-echo.js as in the bellow image
      0_1541006090039_laravel echo config.png
    • then i try to listen like this
      0_1541006352224_echo listiner.png
    • but i always get this error
      0_1541006566211_echo error.png

    i have tried many configuration but it still has not worked.
    please what am i doing wrong and if anyone has a better procedure , i can do with some help here.

    thank you



  • have you tried declaring a Vue.prototype for $echo? maybe try to put it after Vue.use(echo) in your plugin ie. Vue.prototype.$echo = echo.



  • laravel-echo.js:

    import Echo from 'laravel-echo'
    
    window.io = require('socket.io-client')
    
    const echo = new Echo ({
        broadcaster: 'socket-io',
        host: window.locatin.hostname + ':6001'
    })
    
    export default ({Vue}) => {
        Vue.prototype.$echo = echo
    

    Note: I have never used Laravel Echo with Vue., so I am not sure if the instantiation of Echo is correct, I am just going off of your code.

    Now, you can use the above in your code with this.$echo



  • Wow guys. Thank you very much. I will try and send feedback



  • @metalsadman @Hawkeye64 yes it works. i will give more info soon

    thank you



  • @metalsadman @Hawkeye64 yes it works. i will give more info soon

    thank you