Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Pamposgsk's avatar

Using Laravel Echo in Inertiajs

Hi, I am using Laravel 9 with inertia & vite.Could you please send me how can I use Laravel echo in vuejs component to listen to an event? I tried to uncomment bootstrap.js to use Laravel echo globally but with no luck.

0 likes
2 replies
LaryAI's avatar
Level 58

You can use the Echo instance provided by Inertia.js to listen to events. You can access it in your component like this:

export default {
    props: ['echo'],
    mounted() {
        this.echo.channel('channel-name')
            .listen('EventName', (e) => {
                // Do something with the event
            });
    }
}

You can also use the Echo instance to listen to private and presence channels. For more information, you can check out the Inertia.js documentation.

Pamposgsk's avatar

unfortunately it's not working and the link you sent me for documentation is not found. So in order to globally access echo do i need to reference echo and pusher in bootstrap.js or do i need to do something in app.js?

import { createApp, h } from 'vue' import { createInertiaApp } from '@inertiajs/inertia-vue3' import {resolvePageComponent} from 'laravel-vite-plugin/inertia-helpers'; import { InertiaProgress } from '@inertiajs/progress'

createInertiaApp({ resolve: (name) => resolvePageComponent(./Pages/${name}.vue, import.meta.glob('./Pages/**/*.vue')), setup({ el, App, props, plugin }) { createApp({ render: () => h(App, props) }) .use(plugin) .mount(el) }, });

InertiaProgress.init();

Please or to participate in this conversation.