php ratchet websocket SSL connect?

后端 未结 9 2196
遥遥无期
遥遥无期 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:51

    I found this answer on Ratchet's google group by Chris Boden:

    The best solution would be to use Nginx as your web server. Have Nginx listen on port 80 for incoming connections and have it handle your SSL. Nginx will forward incoming connections to PHP-FPM for your regular website and if it detects a connection is a WebSocket connection have it proxy to your running Ratchet application on a port of your choice. Your javascript could then connect via wss://mydomain.org

    This is an alternative way to using stunnel if your application is going to be served using nginx.

提交回复
热议问题