Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Laravel Echo private channel broken after build (minified?) #1074

Answered by danh65
danh65 asked this question in Q&A
Discussion options

Hello,
I have a websocket server set up and working on my local environment and everything is working as expected. The problem I'm having is when I build and deploy out to a live server, something is broken. I can verify the server is running, the channel is connecting, the events are getting broadcasted and the browser is receiving them, but the .listen method does not pick them up. I'm not getting any errors, it's like the event just disappears into nowhere.

One thing I noticed is, on my local machine when I console.log the channel, I get some types showing next to the different properties.
Like so:
image

As you can see, the channel shows PusherPrivateChannel as the type. On the live server, the same console.log shows it's connected, but with different types, simply "n":
image

Not sure what that means, if anything, but wondering if the minification in the build is a problem. Is there something I need to do in the build process to make it work?

Thanks, Dan

You must be logged in to vote

Turns out the problem was being caused by the way I was getting the name of the event I wanted to listen on.

I was defining a variable called modelName assigned by a class .prototype.constructor.name property and then using that in the event listener like this:

It worked fine on my local machine, but when built and minified, that property was returning a single letter as the name and therefore my event name was different and never matched.

Regards, Dan

Replies: 1 comment

Comment options

Turns out the problem was being caused by the way I was getting the name of the event I wanted to listen on.

I was defining a variable called modelName assigned by a class .prototype.constructor.name property and then using that in the event listener like this:
image

It worked fine on my local machine, but when built and minified, that property was returning a single letter as the name and therefore my event name was different and never matched.

Regards, Dan

You must be logged in to vote
0 replies
Answer selected by danh65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /