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

ajw4sk's avatar

Echo on production

I'm having trouble with Laravel Echo (I think). I've built a vue chat app that works locally. I've even cloned it onto another machine and got it working fine. But when I get it onto production, it's not working. I'm not running npm on the server, I'm just doing a run npm prod before committing and pushing to the server. For some reason it just doesn't work though. The messages are getting through to pusher as I can see them in the debug console.

Here's some of the code: mounted() { console.log('mounted');

        Echo.private(`messages.${this.user.id}`)
            .listen('NewMessage', (e) => {
                console.log('in echo');
                this.hanleIncoming(e.message);
            });

        axios.get('/contacts')
            .then((response) => {
                this.contacts = response.data;
            });
    },
    methods: {
        startConversationWith(contact) {
            this.updateUnreadCount(contact, true);

            axios.get(`/conversation/${contact.id}`)
                .then((response) => {
                    this.messages = response.data;
                    this.selectedContact = contact;
                })
        },
        saveNewMessage(message) {
            console.log(message);
            this.messages.push(message);
        },
        hanleIncoming(message) {
            if (this.selectedContact && message.from == this.selectedContact.id) {
                console.log('inside if of handleincoming');
                this.saveNewMessage(message);
                return;
            }

            this.updateUnreadCount(message.from_contact, false);
        },

When local I get all the console.logs, but on prod I only get one and that's because saveMessage gets called on hitting enter from the message chat window. Do I need to install something on the server to get echo to work since I'm not doing npm install on the server. I don't think node is even installed. Any help would be appreciated!

0 likes
1 reply
Mithrandir's avatar

If you don't have node on the server, how do you start the Echo server?

How do you run Echo locally?

Please or to participate in this conversation.