Ezelia / eureca.io

eureca.io : a nodejs bidirectional RPC that can use WebSocket, WebRTC or XHR fallback as transport layers
http://eureca.io/
343 stars 30 forks source link

404 errors with c9.io #10

Closed jloudermilk closed 9 years ago

jloudermilk commented 9 years ago

https://networktesting-lordkuragari.c9.io/ im getting this error in the console when i try to integrate the eureca.io into the tanks multiplayer tutorial

Cannot GET /eureca.io/?_primuscb=1422126090240-1&EIO=3&transport=polling&t=1422126090241-1&b64=1

im a novice web dev so i have no idea what this means

alaa-eddine commented 9 years ago

are you sure that the eureca server is running ? I also see that you are using https, so the HTTP or express server which run eureca.io should use a valid certificate for your subdomain.

if you don't have those certificates run your application from http and make sure that eureca server is using HTTP and not HTTPS

jloudermilk commented 9 years ago

i think it is, here is the server code

var expressIO = require('express.io'), path = require('path');

var app = expressIO(); app.http().io();

var http = require("http"), server = http.createServer(app);

app.use(expressIO.static(path.join(__dirname, 'public')));

//get the EurecaServer class var EurecaServer = require("eureca.io").EurecaServer;

//create and new instance var euServer = new EurecaServer();

//attach eureca.io to you http server euServer.attach(server);

//detect client connection euServer.onConnect(function (conn) {
console.log('New Client id=%s ', conn.id, conn.remoteAddress); });

//detect client disconnection euServer.onDisconnect(function (conn) {
console.log('Client disconnected ', conn.id); });

var changes = -1;

var Gaze = require('gaze').Gaze;

var gaze = new Gaze('public/*/');

// Files have all started watching gaze.on('ready', function(watcher) { changes = 0; });

// any change reload gaze.on('all', function(event, filepath) { console.log('change occur',filepath) ; changes++ ; app.io.broadcast('reload',{version:changes}); });

app.get('/', function(req, res) { res.sendfile(__dirname + '/public/index.html'); });

app.listen(process.env.PORT || 3000, process.env.IP || "0.0.0.0", function(){

console.log("Chat server listening at", process.env.IP + ":" + process.env.PORT); });

but you are the expert,

alaa-eddine commented 9 years ago

seems like you are listening to port 3000 while your URI is exposed on https (port 443) so I suppose that c9.io is using a proxy or something to redirect trafic .... eureca.io will not work behind proxy unless the proxy support HTTP 1.1 and is able to redirect websocket traffic .

also accessing port 3000 directly throught your subdomain don't seem to be working.

your issue seems very specific to c9 environment.

jloudermilk commented 9 years ago

it usually is, c9.io good idea if i can ever get it to work

alaa-eddine commented 9 years ago

I don't think that it'll be possible because it depend on C9 internal configuration. your code seems good, but as I said, if c9 use a proxy you have no control on its behaviour