Comments (13)
Found the problem! Maybe help @winternet-studio or others.
The problem was not on Textalk. The server (Nginx) was missing the intermediate certificate. Checked using https://www.sslshopper.com/ssl-checker.html.
To fix: on Nginx "ssl_certificate" must point to a file with the certificate concatenated with the CA certificate. Just "cat cert.pem ca.pem > output.pem" and use it on Nginx. Same thing on Apache, on "SSLCertificateFile".
Using Let's Encrypt, just use fullchain.pem instead of cert.pem.
from websocket-php.
I too had the same issue with localhost wss:// Below code worked for me for byepassing certificate validation
stream_context_set_option($context, 'ssl', 'verify_peer', false); stream_context_set_option($context, 'ssl', 'verify_peer_name', false);
from websocket-php.
If you can provide some code we'll can help. wss:// works fine for me with apache2 default and php7.0
from websocket-php.
I'm having the same problem, but it shows error on line 60, not on 95.
The server is ok, running wss, and Chrome can connect.
My server is a Nginx running SSL via proxy.
Fatal error: Uncaught exception 'WebSocket\ConnectionException' with message 'Could not open socket to "xxxxx:443": (0).' in /.../textalk/websocket/lib/Client.php:60
from websocket-php.
ssl-checker didn't indicate any problems on my server - it says "all the correct intermediate certificates are installed" and everything else is green as well. I'm also using Let's Encrypt.
Not sure what code to share. I try to connect to the server using this standard code:
$client = new WebSocket\Client('wss://mydomain.com/wss2/', array('timeout' => 10));
In Javascript this code works fine:
var connection = new WebSocket('wss://mydomain.com/wss2/');
If you contact me through my website I can let you know the actual server so you could try it yourself if you're interested.
from websocket-php.
Hi,
I have the exact same configuration with nginx proxying ssl to :8000 websocket server, can connect from browsers, but not from the server itself.
Was wondering whether you've had any luck figuring it out?
Thanks in advance!
from websocket-php.
Sorry, I have not tried anything or found any solutions since my post.
from websocket-php.
Thanks for the reply.
Pity it is.. anyone else perhaps?
from websocket-php.
I've now picked this up again and I found out that it didn't work on my Windows developer machine, but the same code worked fine on a production Linux server. I also tried an asynchronous client https://github.com/ratchetphp/Pawl which also had issue on my local machine but worked fine on Linux server. Hopefully this bit of info might be helpful to someone.
from websocket-php.
I figured it out as well, here is the deal.
- We were using Nginx+Apache configuration on the server.
- Nginx was configured so that it made an ssl-handshake with client and then internally redirected request to websocket's apache port (like 8080).
- So when connecting from clients (JS) we used WSS and it worked - their requests came to nginx that handled SSL and forwarded them to Apache.
- However, when connecting from the same machine from php script, it didn't work.
What worked was connecting to the apache server directly (WS to port 8080 in this example).
Hope this will help someone as well :).
from websocket-php.
I had the sane issue. The problem was that I am restricting access to ws to the origins "localhost" and "our domain". This library doesn't send an origin in the header. Got it fixed by adding
'origin' => 'localhost'
in the $header array in ~ 107 vcendor/texttalk/websocket/lib/Client.php
from websocket-php.
For me also bypassing the SSL worked....
from websocket-php.
I too had the same issue with localhost wss:// Below code worked for me for byepassing certificate validation
stream_context_set_option($context, 'ssl', 'verify_peer', false); stream_context_set_option($context, 'ssl', 'verify_peer_name', false);
hello @sandy5623 it would be great help if you can share the full code as tried the above but unable make it work and also the latest version gives array error in second parameter so not able to figure out how to use above code thanks in advance
from websocket-php.
Related Issues (20)
- Maximum execution time on Header block HOT 3
- Mozilla is not recognized as an internal or external command HOT 1
- Connection with WSS HOT 3
- How can I use this package with laravel? HOT 8
- Update to last version and websocket wss://ws-api.exmo.com:443/v1/public do not work HOT 3
- stream_socket_client(): Unable to connect to ssl HOT 1
- Client Ping/Pong broken in 1.6 HOT 5
- The current version only works on PHP8 HOT 1
- How to install this? HOT 6
- Looping receive() is not working HOT 3
- How to set proxy IP HOT 3
- failed to connect wss HOT 1
- Composer not load method HOT 1
- NOTE: TexTalk replaced by sirn-se/websocket-php
- Upgrade psr/http-message to ^1.1 || ^2.0 HOT 3
- heart break
- permessage-deflate problem HOT 1
- sometimes connection refused, but ends in fatal error HOT 1
- Does this socket work on https?
- 初次使用后的一些体验与几点疑惑,期望得到大佬们的一些帮助,谢谢!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from websocket-php.