php ratchet websocket SSL connect?

后端 未结 9 2180
遥遥无期
遥遥无期 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 04:01

    If you are using Windows IIS, make sure that you have configured it for HTTPS (I'm using self signed certificate), then install reverse proxy:

    URL rewrite: https://www.iis.net/downloads/microsoft/url-rewrite and ARR 3.0: https://www.iis.net/downloads/microsoft/application-request-routing

    You also need to enable websockets support in IIS:

    create folder (e.g. myproxyfolder) for URL rewrite, on this folder create web.config file with content:

    
    
        
            
                
                    
                        
                        
                    
                
            
        
    
    

    and change "http://127.0.0.1:8080" to your websocket service (I'm using Ratched for PHP on WIN).

    On client side in javascript, use secure websockets wss:// protocol, like:

        mysock = new WebSocket('wss://127.0.0.1/myproxyfolder');
    ...
    

提交回复
热议问题