php ratchet websocket SSL connect?

后端 未结 9 2183
遥遥无期
遥遥无期 2020-11-27 03:30

I have a ratchet chat server file

use Ratchet\\Server\\IoServer;
use Ratchet\\WebSocket\\WsServer;
use MyAppChat\\Chat;
require dirname(__DIR__) . \'/vendor/         


        
9条回答
  •  一生所求
    2020-11-27 03:36

    If you are using Apache web server (2.4 or above), enable these modules in httpd.conf file :

    1. mod_proxy.so
    2. mod_proxy_wstunnel.so

    Add this setting to your httpd.conf file

    ProxyPass /wss2/ ws://ratchet.mydomain.org:8888/
    

    Use this URL in your JavaSscript call when you want a WSS connection:

    var ws = new WebSocket("wss://ratchet.mydomain.org/wss2/NNN");
    

    Restart Apache web server and make sure that your Ratchet worker (web socket connection) is open before applying the settings (telnet hostname port).

提交回复
热议问题