got the error using sockets

Problems with the Windows version of XAMPP, questions, comments, and anything related.

got the error using sockets

Postby vr2000 » 04. October 2022 18:59

I have XAMPP installed. I'm testing a chat using sockets on localhost and got the error "WebSocket connection to 'wss://localhost:9443/chat/server.php' failed".
I read how to connect a socket in XAMPP. I have the socket connected in the php.ini file, but I get an error.
Why sockets do not work even though they seem to be connected?
vr2000
 
Posts: 4
Joined: 04. October 2022 18:00
XAMPP version: 2.4.38
Operating System: windows 11

Re: got the error using sockets

Postby IamCarry » 05. October 2022 09:45

Same issue happened with me also.
IamCarry
 
Posts: 1
Joined: 05. October 2022 09:42
XAMPP version: 8.0.19
Operating System: Microsoft 8.1

Re: got the error using sockets

Postby vr2000 » 05. October 2022 18:57

My condolences. I wonder if anyone knows how to deal with this?
vr2000
 
Posts: 4
Joined: 04. October 2022 18:00
XAMPP version: 2.4.38
Operating System: windows 11

Re: got the error using sockets

Postby Froosh » 05. October 2022 21:26

Can't say I've used web sockets with XAMPP, but is XAMPP/apache and whatever services used by your application running when you are loading the URL?
Are you attempting to load the URL from the localhost that actually has the application servicing the web socket application?
Was this application working on your system at any point, and if so, what changed?

For background, I have the version 8.1.10 of XAMPP running on Windows 11, and it is able to server http/https just fine, so I know this version is working. I do not have a web sockets application installed to match your specific setup, so not sure what you could try, or what else to ask.
User avatar
Froosh
 
Posts: 138
Joined: 27. March 2022 17:56
XAMPP version: 8.2.0
Operating System: Windows 11 Pro

Re: got the error using sockets

Postby vr2000 » 05. October 2022 22:08

Thanks for your answer.

Yes, I also just replaced the old XAMPP with XAMPP for Windows 8.1.10 and I also have windows 11.

I generally write WordPress plugins and use XAMPP to test them. And WordPress runs on XAMPP.

Yes, I have this code:
Code: Select all
 var socket = new WebSocket("wss://localhost:8090/wwwchat3/server.php");

and the server.php file is indeed in the project folder.

I recently started learning about sockets. I downloaded an example application with sockets. I put this application on XAMPP and I see the error that I wrote about earlier. I also placed this application on a real hosting and it works there and does not give an error.
vr2000
 
Posts: 4
Joined: 04. October 2022 18:00
XAMPP version: 2.4.38
Operating System: windows 11

Re: got the error using sockets

Postby Froosh » 06. October 2022 00:18

I know WP works with XAMPP, I use that it for that, too.

Have you confirmed the Apache configuration, and possibly bits of XAMPP have not changed with updating to 8.1.10. I usually make a backup of this stuff prior to installing a new version, as I am not sure that my customized settings configuration is preserved.

I've personally not tried using web sockets with XAMPP. If you did any configuration of XAMPP and Windows Firewall, I would verify that those are still in place. Other than that, not sure what else to suggest at this point.
User avatar
Froosh
 
Posts: 138
Joined: 27. March 2022 17:56
XAMPP version: 8.2.0
Operating System: Windows 11 Pro

Re: got the error using sockets

Postby Nobbie » 06. October 2022 16:34

Its not sufficient to call the PHP server script in a browser only, you also have to run it in CMD Shell (where it act as server). See also https://stackoverflow.com/questions/473 ... mpp-server
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: got the error using sockets

Postby vr2000 » 07. October 2022 11:42

Thanks for the answer. Yes, I tried to start the server through CMD Shell, but the sockets still do not work. Looks like I need to read more about them.
vr2000
 
Posts: 4
Joined: 04. October 2022 18:00
XAMPP version: 2.4.38
Operating System: windows 11


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 119 guests