PHP Websocket connection is being established with ws protocol but cannot be establish using wss protocol

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. |, so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is:
I ran this command: I created a websocket server using Ratchet PHP. It is using 8443 port. All the firewall permissions are there for the port since I can establish a connection using the ws:// protocol but the connection is not being established using the wss:// protocol. I have even given the file paths of the ssl certificates and the private key and still ws is working but not wss.

It produced this output: Connection of ws:// is made but not wss://.

My web server is (include version): Apache

The operating system my web server runs on is (include version): AlmaLinux 8.9

My hosting provider, if applicable, is: Hostinger

I can login to a root shell on my machine (yes or no, or I don't know): Yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): Yes

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): certbot 1.22.0

Do you have a valid cert?
If not, we can help.
If you do, then there isn't much more this forum can do for you.

Did you follow a guide to install the cert into that service?


If the wss speak of is this one "6602 Yes Microsoft Windows WSS Communication",
so that would be on Port 6602 which looks filtered.

$ nmap -Pn -p6602
Starting Nmap 7.94SVN ( ) at 2023-12-28 15:39 PST
Nmap scan report for (
Host is up (0.27s latency).

6602/tcp filtered wsscomfrmwk

Nmap done: 1 IP address (1 host up) scanned in 0.78 seconds

If I had to guess [which I have no other alternative] ...
I'd say that you've attached HTTP/WS to port 8443.
And then tried to also attach HTTPS/WSS to port 8443.
It can't do both.

$ nmap -Pn -p80,443,6602,8443
Starting Nmap 7.94SVN ( ) at 2023-12-28 15:46 PST
Nmap scan report for (
Host is up (0.28s latency).

80/tcp   open     http
443/tcp  open     https
6602/tcp filtered wsscomfrmwk
8443/tcp open     https-alt

Nmap done: 1 IP address (1 host up) scanned in 0.59 seconds
1 Like

Well I found this WebSocket - Wikipedia for reference.

1 Like

Thx Bruce & Rudy for the prompt response, after trying whole night, we've just packed for the day. Will get back with the result on all the action points as suggested by you both by tonight (IST).
Thx again.


The fact ws:// works, but wss:// doesn't tells me you didn't configure the certificate (properly) for your WebSocket service. Unfortunately, the only information to go with, is that you did so using "Ratchet PHP using port 8443". There is no information about HOW you actually did that and HOW the certificate comes into play. Simply configuring HTTPS on port 443 is not enough to magically make WebSockets work too :slight_smile:


ProxyPass /ws/ wss://
ProxyPassReverse /ws/ wss://

I have put proxy in the httpd.conf file but still the wss connection is not being established. In the httpd.conf file the ssl certificate paths are also given.

and this is how i am implementing the websocket server.

Also I changed the port from 8443 to 8888 after looking at certain solutions but still to no avail.

Is that wss:// only used in the ProxyPass command? Because if so, why not use localhost and ignore the whole TLS thingy if it's local only?


I thought you were asking to hit the site from the internet with WSS://
It looks like your configuring HTTPS:// from the Internet and then that web service makes an internal proxy request via WSS://
[which would NOT need to be encrypted - locally].


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.