Laravel WebSockets - deployment - fails to connect the websocket - laravel

I am trying to deploy my laravel project with websockets built on Beyond Code's package.
My server is on AWS and i'm using WHM.
on the cPanel's terminal i'm running the line php artisan websockets:serve
and i get the result Starting the WebSocket server on port 6001...
when i'm loading the page with the websocket's connection sometimes i get the error failed: Error during WebSocket handshake: Unexpected response code: 200
and sometimes i get the error failed: WebSocket is closed before the connection is established.
On AWS EC2's Security Groups i allowed the Custom TCP port 6001 and 6002
Any suggestions to fix it?
Maybe a good deployment tutorial for Laravel WebSockets?
I'm looking for answers all over the internet and i get nothing useful.

Related

Connecting to AxonServer node [****] failed: UNAVAILABLE: Network closed for unknown reason

I am new to axon server. I use axon server as remote server in spring boot. not in the localhost. but when the spring boot application connect to the server it fails and show the fallowing error.
Connecting to AxonServer node [174.298.31.***:8024] failed: UNAVAILABLE: Network closed for unknown reason
Failed to get connection to AxonServer. Scheduling a reconnect in 2000ms
my property file like below,
axon:
axonserver:
servers: 174.298.31.***:8024
if you didn't change the default port, 8024 is the default port for HTTP access to the server dashboard. but when you try to connect to the server using a client, it is not the communication port, the communication protocol is 8124. please try putting 8124 port. 8024 only for the dashboard.
axon:
axonserver:
servers: 174.298.31.***:8124

wstransport.js:218 WebSocket connection to 'wss://chunderw-vpc-gll.twilio.com/signal' failed: Unknown reason

I'm getting this error while integrating Twilio task router. on localhost, so I thought might be its https error so I tried through Heroku but still getting the same error.

Poloniex Push WAMP API through Autobahn dropping connection to peer tcp

I tried to connect to the Push API in poloniex using python and followed the instructions on the answer here:
How to connect to poloniex.com websocket api using a python library
However I keep getting this error:
2017-06-25T04:07:04 dropping connection to peer tcp:104.20.13.48:443 with abort=True: WebSocket opening handshake timeout (peer did not finish the opening handshake in time)
Anyone know what's going on here? I can't figure it out from online documentation. Thanks!
As per #Cyphrags suggestion, I was able to get my autobahn websocket to work outside of localhost by increasing openHandshakeTimeout with factory.setProtocolOptions
factory.protocol = MyClientProtocol
factory.setProtocolOptions(failByDrop=False, openHandshakeTimeout=90, closeHandshakeTimeout=5)
Solution found via https://github.com/crossbario/crossbar/issues/930. Perhaps the reason it is needed has something to do with slow DNS routing taking longer than the default handshake time.

Why is this websocket connection being refused?

I try to use the slack-sample bot from this blogpost https://www.opsdash.com/blog/slack-bot-in-golang.html . I've successfully created my api token, but i can not connect to the websocket server (the rtm.start request passs normally). I've get the error message
dial tcp 54.242.95.213:443: connectex: No connection could be made because the target machine actively refused it
I've also tried to connect via a chrome app called Simple Web Socket Client and via a website based one tester. Both work well, i can establish a connection and i can send data.
I'm behind a proxy, but i only have troubles with golang's websocket.Dial function.
Does anybody know why this can happen?
I use:
- Windows 7 SP1 x64
- Golang 1.7.1 windows/amd64
Greetings
Tonka
If you are using gorilla/websocket, it has the ability to use a Proxy. From issue 107:
import "net/http"
...
var dialer = websocket.Dialer{
Proxy: http.ProxyFromEnvironment,
}
If you are using golang.org/x/net you should switch to gorilla/websocket.

Other hosts cannot connect to websocket server on my host

First of all, sorry for my bad English : )
My Java application (multiplayer game server) uses this package to communicate with a web application in client's browser using websockets: https://github.com/TooTallNate/Java-WebSocket
I've encountered a problem running my application: only I can connect to the websocket server, clients on other hosts can't do so. In browser I estabilish connection as usual, address here is certainly correct:
new WebSocket("ws://"+serverIp+":8787");
When I connect from my own host to the websocket server running on the same host, it runs perfectly. When other hosts try to connect to me, connection in not being estabilished: in browser WebSocket objects's .readyState is 0 (whilst it should be 1), and even server does not recieve any handshakes (no output from onClientOpen in server console, I even tried to get any output from certain WebSocketServer class' methods).
Other hosts are still recieving, for example, static contents of web application from webserver on 80 port on the same host. Problem is not the closed 8787 port: I checked it, it's open.
What may be the reason that other host can't connect to my websocket server?
WebSockets uses a cross-origin permission system. You might need to tell you WebSocket server to accept connections from more than just your local host. The verification of Origin happens during the WebSocket handshake which likely happens prior to onclientOpen.

Resources