-
Notifications
You must be signed in to change notification settings - Fork 661
-
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
Beta Was this translation helpful? Give feedback.
All reactions
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
-
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
Beta Was this translation helpful? Give feedback.