Closed X4V18 closed 9 years ago
If you are using nginx, haproxy, or apache, you can route the traffic to stunnel
terminitating the ssl.
so in your client side code you would connect to for example
http://example.com/path/to/socketserver:8000
which your web server would redirect to stunnel , then in turn stunnel would terminate the ssl and route it back to the actual listening location of your php script. Alot of developers use techniques like this, since stunnel can handle the ssl encryption/decryption much more efficiently(and faster) than a server side scripting language.
here's a tutorial i found by googling the subject.
http://afitnerd.com/2012/08/14/websockets-over-ssl-stunnel-haproxy-node-js/
edit: a simpler method
https://vec.io/posts/goliath-secure-websocket-ssl-wss-with-stunnel-varnish-nginx
I think this might be fixed by #57
It's available on >= 2.0.4 (or 2.0.5-beta). Please reopen an issue if it doesn't help. And thanks for reporting.
(Total derp fix in the end: comma/period :()
There is a problem in the code for the SSL, I created an auto-signed certificate and generated an .pem file. I try your example application Echo, it seems to contain problem in the code for ssl. Here's my code :
Client :
Errors:
*PHP Warning: stream_socket_accept(): failed to create an SSL handle in D:\wamp\ www\PrivateChat\lib\Wrench\Socket\ServerSocket.php on line 87
*PHP Warning: socket_last_error() expects parameter 1 to be resource, boolean gi ven in D:\wamp\www\PrivateChat\lib\Wrench\Socket\ServerSocket.php on line 90
*err: Socket error: exception 'Wrench\Exception\ConnectionException' with message 'Operation complete. ' in D:\wamp\www\PrivateChat\lib\Wrench\Socket\ServerSocket.php:90