Pusher private chat works on localhost, not working on live server - pusher

I have developed a chat system using laravel and Vue. Am using pusher for realtime communication. Everything works well on localhost. But on pushing to live server (shared hosting), the chat does not work. The error on pusher debug is: Cannot broadcast client event (connection not subscribed to channel private-chat1).
However, the message can be seen on the debug console.
Question:
Does shared hosting has anything to do with the chatapp failing?
Does SSL affect? (the domain is ssl installed)
What else can I check.
Really tried to troubleshoot unsuccessfully.

Related

Socket.io, Unreal, & Heroku (Node js) : Client not connecting to server?

I'm currently working on a game that connects to a Node.js server for multiplayer data.
The game is developed in Unreal Engine 4 and uses the Socket.io plugin to connect to the Node.js server (cors, express being used).
Everything works locally. So now I'm trying to move on to hosting the server remotely and connecting the unreal client to the remote Node.js server.
I looked into Heroku and set myself up, everything is working fine on its end to my knowledge - I created a tester page with a success message when you load the URL and that comes through.
My first question is - what am I doing wrong when I use unreal to point the socket.io plugin to the server url?
The socket.io plugin asks for a port #, I've tried the following:
http:/{my server/heroku url}:8080/
http:/{my server/heroku url}:3000/
http:/{my server/heroku url}:18279/ (which was given to me by Heroku).
http:/{my server/heroku url}/
So far the game does not connect to the deployed server, the way it does locally.
Any suggestions on what could be going wrong/what am I failing to do next?
A few things after researching:
I do have http-session-affinity enabled
Since the server is working locally, I'm going to make the assumption that the deployed code is not the issue, and that it has to do with the way I'm trying to connect.
is it possible that I have further authorization to config? Such as allowing the unreal game/client to connect to the server/that the client is being blocked some how?
I figured out the issue, it had to do with how my Node.js server code was calling socket.io.
If you come across this issue please send me a message or comment here and I will be happy to send you the code that worked.

Socket IO - WSS Throwing error -- remote client, local server

Hi I've been trying to figure this out for some time now. It's kind of hard to explain... Ill try and give some background : I'm trying to create a pwa that can work on WAN and LAN for when offline. ---- So I have a client and server, if I host the client and server both locally I'm having no issues I can connect to one another directly and everything, the socket.io and web socket work great. If I host the client and server both on Heroku they work great as well. The problem comes when I host the client on Heroku and the server locally -- which in the application I'm working on I need this. Im able to still connect to the other user if im using the WAN connection portion but if I try to make the connection using LAN it throws errors. I'm not sure what is going on, I'm still fairly new socketio, websockets, etc... ---- Here is the error I am getting Error Image. Here are my imports on the server - imports-server, how I'm setting up the server - server setup, how I set up the connection on the client -- client setup. Sorry if I wasn't clear on my explanation, thank you for help.

socket.io client can't upgrade from XHR long polling to websocket

We have a server which do implement socket.io in NodeJS on Heroku.
We have a bunch of clients (Raspberry pi's) destributed on different networks across our country. They do implement socket.io clients in a NodeJS application.
It do work very well on 17/18 devices. We do have one device which are not able to upgrade the socket.io connection from a long-polling type to an actual websocket.
I cannot find the reason why.
Our server is setup with the following options:
Server settings
This is what the logs on our heroku server tells about the connection with the problematic client:
Heroku logs
As all clients are setup exactly the same way, i do not actually suspect any problems on the raspberries themselves.
Could it be a network problem where this one client is located?
- Behind the router, blocking some port etc?
Hope you have some suggestions to what the problem could be.
You tell if you need anymore information.

Deploying a socket.io app in on multiple-nodes

I have an app on heroku that uses socket.io for server-client communication. Everything is working just fine. However, once I scale my app to more than 1 dyno, I get several http request errors:
can't establish a connection to the server at wss://***/socket.io/?EIO=2&transport=websocket&sid=Hky6IHdckNADdU_tAACm. socket.io.js:4520
The connection to wss://***/socket.io/?EIO=2&transport=websocket&sid=Hky6IHdckNADdU_tAACm was interrupted while the page was loading. socket.io.js:4520
can't establish a connection to the server at wss://***/socket.io/?EIO=2&transport=websocket&sid=kWymv6ItJHBcUybZAAAA. socket.io.js:4520
The connection to wss://***/socket.io/?EIO=2&transport=websocket&sid=kWymv6ItJHBcUybZAAAA was interrupted while the page was loading. socket.io.js:4520
As well as a load of
HTTP status 400
{ code: 1, message: "Session ID unknown" }
My socket.io is using the redis adapter, so the state should be shared correctly. I kind of verified this by connecting to redis and issuing the following command:
PSUBSCRIBE socket.io#*
Since I can see data traveling back and force on this channel, I am assuming my socket.io redis adapter is working fine.
Anyone know how to make socket.io work on heroku with more than 1 dyno?
You need sticky load balancing. Socket.io has a great article on it, so I'll leave it to them to explain the topic:
https://socket.io/docs/using-multiple-nodes/

Websocket not working with socket.io in heroku

My app is working fine in localhost with socket.io using websockets and xhr-polling and it's working with xhr-polling in heroku, but since heroku provided support for websocket I canĀ“t make it work using websockets.
My Chrome console shows this message:
WebSocket connection to 'ws://<myherokuapp>.herokuapp.com/socket.io/1/websocket/HBWE2BFvHahlSWk5ppHP' failed: Unexpected response code: 503
I already enabled websocket labs.
Is there any working example of websocket using socket.io?
I had the same problem and just fixed it by reactivating the websockets on my app on heroku.
It had just randomly switched over to XHR polling for some reason.
I used this command from heroku's site (# https://devcenter.heroku.com/articles/heroku-labs-websockets) to reactivate it:
heroku labs:enable websockets -a myapp
I then restarted my server by pushing to heroku and having it rebuild (or using: heroku restart).
I also have a working copy of a very basic socket.io chat application (written by Smitha Milli) running at: http://calm-gorge-8474.herokuapp.com/ that you can test.
Hope this helps!

Resources