Unable to connect to socket io running on port 3000

nodejs

#1

Hi,

I am trying to implement this example

https://laracasts.com/discuss/channels/general-discussion/step-by-step-guide-to-installing-socketio-and-broadcasting-events-with-laravel-51

I have got most things working but when running the listener page I am getting connection timeouts for the socket io connection like this -

socket.io-1.4.5.js:1 GET http://logsdashboard-jachno.c9users.io:3000/socket.io/?EIO=3&transport=polling&t=LF8RPeq net::ERR_CONNECTION_TIMED_OUT

this is the code used to start the server

> var app = require('express')();
> var http = require('http').Server(app);
> var io = require('socket.io')(http);
> var Redis = require('ioredis');
> var redis = new Redis();
> redis.subscribe('test-channel', function(err, count) {
> });
> redis.on('message', function(channel, message) {
>     console.log('Message Recieved: ' + message);
>     message = JSON.parse(message);
>     io.emit(channel + ':' + message.event, message.data);
> });
> http.listen(3000, function(){
>     console.log('Listening on Port 3000');
> });

and this is the javascript running on the page

<script>
    //var socket = io('http://localhost:3000');
    v    ar socket = io('http://logsdashboard-jachno.c9users.io:3000');
      //      var socket = io.connect("/");

               alert('test');
        socket.on("test-channel:App\\Events\\EventName", function(message){
            // increase the power everytime we load test route
            alert('test');
            $('#power').text(parseInt($('#power').text()) + parseInt(message.data.power));
        });
    </script>

not sure where else to go with this, does anyone know if port 3000 is blocked on Cloud 9?


#2

There are 3 ports available. The rest are blocked on the outgoing side. 8080, 8081, 8082. Only web traffic is allowed out thru them as well. This is stated in the docs.