yiicod / yii2-socketio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connection refused [tcp://127.0.0.1:6379]

durino13 opened this issue · comments

I am trying to use socket.io in my project. Everything works locally ;) My browser establishes a connection with the node server and once I emit the event, I see it in the browser.

When I deploy the application on the server, I get following error:
Connection refused [tcp://127.0.0.1:6379]
It looks like some kind of process can't connect to the redis service running on this port. The sysadmin running the told me, that the service is running on that port (he event sent me some 'netstat') output, which proved that.

I have tried to use the 'predis' library and I wrote a piece of PHP code, which was able to connect to the service and the port:
` public function actionTest()
{
\Predis\Autoloader::register();

    try {
        $redis = new \Predis\Client();

        // This connection is for a remote server
        $redis = new \Predis\Client(array(
            "scheme" => "tcp",
            "host" => "localhost",
            "port" => 6379
        ));
        echo 'Connection successful';
    } catch (Exception $e) {
        die($e->getMessage());
    }
}`

When I execute this on the server, I get a 'connection successfull' message. I run these commands in order to start the socketio services:
php yii socketio/php-server and php yii socketio/node-js-server .. I think socket should be OK, because I can see the connection in the browser developer tools (WS tab) and there are no errors in the console.

Any idea what could be the problem? I am lost ;(