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

getting started with eureca.io #16

Closed magicmike closed 9 years ago

magicmike commented 9 years ago

Finding eureca.js.

I also wondered this, and on the first example in the home page, get the error: ReferenceError: Eureca is not defined var client = new Eureca.Client();

Which suggests that it can't find it. Any ideas?

Edit: I have read it's generated on the fly, so it is worth mentioning that I'm running the node server on one machine and the client on another ... so the client does not have access to anything except the index.html and associated JavaScript.

alaa-eddine commented 9 years ago

if eureca code is run in your server machine then /eureca.js should be accessible from client machine. what does the browser console say about it ?

can you show your client/server codes ?

magicmike commented 9 years ago

Absolutely, thank you for the help.

Server code: (app.js)
//============================================
// Copied directly from http://eureca.io/ homepage first example.
//=====================================================

Client code: (index.html)
//============================================
<!doctype html>
<html class="no-js" lang="">
    <head>
        <title></title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="css/main.css">
        <script src="https://code.createjs.com/easeljs-0.8.1.min.js"></script>
        <script src="/eureca.js"></script>
        <script src="./js/Button.js"></script>
        <script src="./js/Card.js"></script>
        <script src="./js/PlayerState.js"></script>
        <script src="./js/easelInit.js"></script>
    </head>
    <body onload="init();">
    <script>
        var client = new Eureca.Client();
        client.ready(function (serverProxy) {
            serverProxy.hello();
        });
    </script>
    </body>
</html>
alaa-eddine commented 9 years ago

do you see any error in the browser console ?

find eureca.js in the networking tab of the browser console, it should tell you if the script is loaded or not.

magicmike commented 9 years ago

It loaded. All my other javascript files (which previously worked) are now 404, not found.

alaa-eddine commented 9 years ago

there are chances that you have something wrong in the server or client side. this is not related to eureca but to your network. try to run the application in a local server first.

magicmike commented 9 years ago

Yes. I got it working. Thanks for your help.

alaa-eddine commented 9 years ago

welcome :)

amytilly commented 8 years ago

I get the same error. I've a normal node.js/express server installed.

Here my server code :

var app = require('../app'); var debug = require('debug')('eureca.io:server'); var http = require('http'); var Eureca = require('eureca.io');

var port = normalizePort(process.env.PORT || '3000'); app.set('port', port);

var server = http.createServer(app);

// eurecaServer init var eurecaServer = new Eureca.Server(); eurecaServer.attach(server);

on client side :

load file : src="/eureca.js"

var rpcClient = new Eureca.Client();

I get always 404 in my browser.

I've tried also {transport: 'sockjs'} but i get the same error.

Please, can you help me ?

alaa-eddine commented 8 years ago

Hi @amytilly , if you are getting 404 errors, this is mostly related to your server or network setup. eureca.io don't setup its own server, it use an existing one.

if you disable all eureca.io stuff, are your static files accessible ?