SSL [SOLVED]: Using Ratchet WsServer in combination with React SecureServer (WSS / SSL)

SSL [SOLVED]: Using Ratchet WsServer in combination with React SecureServer (WSS / SSL)

Home Forums SSL SSL [SOLVED]: Using Ratchet WsServer in combination with React SecureServer (WSS / SSL)

Tagged: , ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36780

    Anonymous

    QuestionQuestion

    We are trying to implement websockets over secure connection (WSS) and have cboden/ratchet implemented in our project. All Works fine over normal connection. Looking around in the docs and the Github project pages, it seems te new React SecureServer class is not yet implemented in Ratchet.

    In the issues we found a post about it, and it won’t be supported untill later versions, however, we need it now 😀
    At the issue report they suggest using the new React SecureServer class in combination with Ratchet classes.. We tried and got a fatal error:

    Catchable fatal error: Argument 1 passed to ReactSocketSecureServer::__construct() must be an instance of ReactSocketServer, instance of RatchetHttpHttpServer given.

    Part where it goes wrong:

    $webServer = new RatchetServerIoServer(
        new ReactSocketSecureServer( // Using React class here as suggested
            new RatchetHttpHttpServer(
                new RatchetWebSocketWsServer(
                    new RatchetWampWampServer(
                        $pusher
                    )
                )
            )
        ),
        $webSock, 
        array(
            'local_cert' => 'xxxx.pem',
            'allow_self_signed' => true,
            'verify_peer' => false
        )
    );
    

    Are we doing something stupid? :p

    #36781

    Anonymous

    Accepted AnswerAnswer

    The secure server is supposed to be wrapped around the socket server, not the HTTP server:

      $webServer = new RatchetServerIoServer(
        new RatchetHttpHttpServer(
            new RatchetWebSocketWsServer(
              new RatchetWampWampServer(
                $pusher
              )
            )
          )
        ),
        new ReactSocketSecureServer( // Using React class here as suggested
          $webSock,
          $loop,
          array(
            'local_cert' => 'xxxx.pem',
            'allow_self_signed' => true,
            'verify_peer' => false
          )
        )
      );
    

    Source: https://stackoverflow.com/questions/47993487/using-ratchet-wsserver-in-combination-with-react-secureserver-wss-ssl
    Author: WyriHaximus
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.