Ratchet: How Using Ratchet Websocket with Port Forwading ?

Created on 4 Sep 2018  路  1Comment  路  Source: ratchetphp/Ratchet

Can anyone guide me how can I use Ratchet WebSocket with "port forwading" status?

websocket runs smoothly when I try from localhost, but it doesn't run smoothly when I try to "forward the port" so that it can be accessed on the internet.

this is my directory details
bin
|--(chat-server.php)
src
|--(Chat.php)
vendor
composer.json
composer.lock

chat-server.php

<?php
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use MyApp\Chat;

    require dirname(__DIR__) . '/vendor/autoload.php';

    $server = IoServer::factory(
        new HttpServer(
            new WsServer(
                new Chat()
            )
        ),
        8080
    );

    $server->run();

I tried to forward port 8080 and still failed.
This is the message I got from the console

WebSocket connection to 'ws://localhost:8080/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

I'm still new to the WebSocket, maybe there's something I miss.
help will really be appreciated, thank you. im sorry about my english.

>All comments

solved !!!
btw thanks for Rachet Websocket

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Opice picture Opice  路  4Comments

Hemant3105 picture Hemant3105  路  6Comments

johankitelman picture johankitelman  路  3Comments

DmitryPorotov picture DmitryPorotov  路  3Comments

ThePatzen picture ThePatzen  路  3Comments