Websocket doesn't work in server 127.0.0.1:8000 - symfony

I'm using Gos Web Socket Bundle in Symfony and I try to work in demo they give. I'm very confuse about the port because the it works, if the port is 127.0.0.1:1337 but when I run the server of symfony it generate 127.0.0.1:8000, so I try to add it here'
gos_web_socket:
server:
port: 8000 #The port the socket server will listen on
host: 127.0.0.1 #The host ip to bind to
router:
resources:
- '#AppBundle/Resources/config/pubsub/routing.yml'
and the websocket in javascript
var websocket = WS.connect("ws://127.0.0.1:8000");
When the time I display it in my page. I always get bad request. But If I use WS.connect("ws://127.0.0.1:1337"); it works, and the server I run from symfony is 127.0.0.1:8000. I'll be glad if you explain the reason why I need to use 1337 port than 8000

IMHO the port 8000 is already occupied with some other service. I would be suspicious of PHP builtin server, so check the port which is the server listening on by php bin/console server:status. If the port is 8000, then stop it php bin/console server:stop and start on some other port php bin/console server:start 127.0.0.1:8000 and the websocket shoud then be available on 8000.

Related

Laravel Homestead Mailhog Error listening on socket: listen tcp 0.0.0.0:1025: bind: address already in use

I am struggling to make MailHog work in my Laravel Homestead VM.
If I browse http://localhost:8025/, the web browser says it can't find it.
Then, in the command line, when executing $ mailhog, I get the following error:
Error listening on socket: listen tcp 0.0.0.0:1025: bind: address
already in use
Moreover, if I execute $ mailhog --invite-jim then I get:
2021/09/13 22:49:22 Using in-memory storage 2021/09/13 22:49:22 [SMTP]
Binding to address: 0.0.0.0:1025 [HTTP] Binding to address:
0.0.0.0:8025 2021/09/13 22:49:22 Serving under http://0.0.0.0:8025/ 2021/09/13 22:49:22 [SMTP] Error listening on socket: listen tcp
0.0.0.0:1025: bind: address already in use
Here is my .env config file
.env
MAIL_MAILER=smtp
MAIL_HOST=localhost
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=reply#app.io
MAIL_FROM_NAME="${APP_NAME}"
Does anyone know or can shed some light how to make MailHog work?
Mailhog web interface is clearly listening at the 8025 port. The localhost or 127.0.0.1 address may not work by default.
Take a look at both the /etc/hosts and Homestead.yml file
$ sudo vim /etc/hosts
$ vim Homestead.yml
Look for the address that Homestead is working on. In this case it's 192.168.10.10 or 192.168.56.56
So now try
http://192.168.10.10:8025 or http://192.168.56.56:8025
And it should be working now

Kubernetes Dashboard : Dashboard keeps cancelling connection to pod, resulting in bad gateway to user

I am using kubernetes-dashboard to view all pods, check status, login, pass commands, etc. It works good, but there is a lot of connectivity issues related to it. I am currently running it on port-8443, and forwarding the connection from 443 to 8443 via Nginx's proxy pass. But I keep getting bad gateway, and connection keeps dropping. It's not an nginx issue, since I have kubernetes error. I am using Letsencrypt certificate in nginx, What am I doing wrong?
Error log :
E0831 05:31:45.839693 11324 portforward.go:385] error copying from local connection to remote stream: read tcp4 127.0.0.1:8443->127.0.0.1:33380: read: connection reset by peer
E0831 05:33:22.971448 11324 portforward.go:340] error creating error stream for port 8443 -> 8443: Timeout occured
Theses are the 2 errors I constantly get. I am running this command as a nohup process :
nohup kubectl port-forward -n kubernetes-dashboard service/kubernetes-dashboard 8443:443 --address 0.0.0.0 &
And finally my nginx config :
default :
location / {
proxy_intercept_errors off;
proxy_pass https://localhost:8443/;
}
Thank you. :-)
Unfortunately this is an on-going issue with Kubernetes' port forwarding. You may find it not particularly reliable when used for long-running connections. If possible, try to setup a direct connection instead. A more extended discussion regarding this can be found here and here.

How to make ngrok client listen a specific hostname instead of localhost?

My yaml config is like this:
yarn:
hostname: "ngrok.xfl.me:810"
remote_port: 810
proto:
tcp: 8088
My purpose is:
Forwarding https://ngrok.xfl.me:810-> 192.168.0.104:8088
But by default, as the config above, ngrok client just listen to 127.0.0.1. So it failed to connect.
How can I make the ngrok client listen to a certain hostname 192.168.0.104 instead of localhost
Thanks a lot!
It was solved with:
yarn:
hostname: "ngrok.xfl.me:810"
remote_port: 810
proto:
tcp: 192.168.0.104:8088

Symfony2 - GeniusesOfSymfony/WebSocketBundle ssl error connection

I need to configure my project with ssl.
So, i have Mamp Pro, and i have created a new Generated SSL certificate.
My server is running via Https,
Right now, i cant connect to server via Javascripts client :
After 10 sec, this is the javascripts error that ive got :
WebSocket connection to 'wss://127.0.0.1:4000/' failed: Error in connection establishment: net::ERR_TIMED_OUT
(index):111 Disconnected for Connection could not be established. with code 3
and this is my configuration :
gos_web_socket:
pushers:
wamp:
host: 127.0.0.1
port: 4000
server:
port: 4000 #The port the socket server will listen on
host: 127.0.0.1 #The host ip to bind to
router:
resources:
- #AppBundle/Resources/config/pubsub/routing.yml
This is the javascripts code :
var websocket = WS.connect("wss://127.0.0.1:4000");
websocket.on("socket/connect", function(session)
Any help please ?

How to run 'ionic serve' in global WEB?

I'm new in Ionic Framework, so I need your help. When I'm running ionic serve on localhost everything is great. But now I'm trying to work with Cloud9, it prints:
The port 8100 was taken on the host 172.17.12.3 - using port 8101 instead
The port 35729 was taken on the host 172.17.12.3 - using port 35730 instead
Running live reload server: http://172.17.12.3:35730
Watching : [ 'www/**/*', '!www/lib/**/*' ]
Running dev server: http://172.17.12.3:8101
But this adresses don't work at all. And i get an error from Cloud9:
Error: you may be using the wrong PORT & IP for your server app. Try passing $PORT and $IP to properly launch your application.
So how can I set $PORT and $IP in Ionic?
Since Cloud9 forwards port 8080 (which is the value of $PORT), you need to tell ionic to use that instead. With the recent change of allowing multiple ports, port 8081 and 8082 are also allowed, so you need to tell ionic to use 8081 (or 8082) as the livereload ports. The command that should work is:
ionic serve -p 8080 -l 8081
I also think that adding -a would help since with that option it appears to bind to IP 0.0.0.0 which you should be binding to in the first place. For more information about Ionic cli options, please check out the Ionic CLI github page
simple solution is to close the terminal in which you are running the serve request and open new terminal then give ionic serve request it will take the 8100 port (which you gave in your code)

Resources