Your Location is: Home > Php

Ratchet PHP Websocket running on Debian

From: Paraguay View: 4672 Meggy 


I'm running the following Ratchet script on Debian;


use Workerman\Worker;

require_once  '/var/www/app/vendor/autoload.php';

// SSL context.
$context = array(
    'ssl' => array(
        'local_cert'  => '/var/www/app/certs/cert.pem',
        'local_pk'    => '/var/www/app/certs/key.pem',
        'verify_peer' => false,

// Create a Websocket server with ssl context.
$ws_worker = new Worker('websocket://my.server.ip.address:2346', $context);

// Enable SSL. WebSocket+SSL means that Secure WebSocket (wss://). 
// The similar approaches for Https etc.
$ws_worker->transport = 'ssl';

$ws_worker->onMessage = function ($connection, $data) {
    // Send hello $data
    $connection->send('Hello ' . $data);


The script runs ok when I do

 php workermanserver.php start

I see;

----------------------------------------------- WORKERMAN -----------------------------------------------
Workerman version:4.0.15          PHP version:7.3.23
------------------------------------------------ WORKERS ------------------------------------------------
proto   user            worker          listen                             processes    status      
ssl     root            none            websocket://my.server.ip:2346    1             [OK]       

But when I visit 'websocket://my.server.ip.address:2346' in my browser I get;

Your search - websocket:// - did not match any documents.


Make sure that all words are spelled correctly.
Try different keywords.
Try more general keywords.

Any idea where I'm going wrong?

Best answer