eureca.io : a nodejs bidirectional RPC that can use WebSocket, WebRTC or XHR fallback as transport layers
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples keep track of examples repo. Mar 31, 2018
lib v 0.8.1 Apr 13, 2018
spec v 0.8.0 Mar 31, 2018
src v 0.8.1 Apr 13, 2018
.gitignore v 0.8.0 Mar 31, 2018
Changelog.txt v 0.8.1 Apr 13, 2018
Readme.md v 0.8.0 Mar 31, 2018
gulpfile.js v 0.8.0 Mar 31, 2018
index.js v 0.8.1 Apr 13, 2018
package.json 0.8.2 : version number Apr 13, 2018

Readme.md

eureca.io

eureca (Easy Unobstructive REmote CAll) is a node.js bidirectional RPC library which can Websockets or WebRTC as transport layers. It allow you to call server side function from a browser or nodejs client and vice-versa.

  • WebRTC support is based on node-webrtc.

  • Websockets support is based on Primus.io making it possible to delegate the websocket part to any supported library by primus, including : engine.io, sockjs, faye, ws and uws.

please visit the project web page for more code samples http://eureca.io/

Documentation

The documentation.

Setup

NPM

Hello World example

Client calling server

Server side code

var Eureca = require('eureca.io');
var eurecaServer = new Eureca.Server();

eurecaServer.exports.helloServer = function (userName) {
	console.log('Hello Server from ',userName);
}

Browser client side code

<script src="/eureca.js"></script>

<body>
<script>
var client = new Eureca.Client(); 

client.ready(function (serverProxy) {

	serverProxy.helloServer();  //will call helloServer in the server side
	
});
</script>
</body>

Nodejs client side code

var Eureca = require('eureca.io');
var client = new Eureca.Client({ uri: 'http://localhost:8000/' });
 
client.ready(function (serverProxy) {
	serverProxy.helloServer();
});

More examples

please check node_modules/eureca.io/examples/ for some example codes

running 1-http-server example code

open a terminal window and type and cd to node_modules/eureca.io/examples/1-http-server/

     node server.js

now you can either open a browser window on http://localhost:8000/ or open another terminal window in the same directory and call open a terminal window and type and cd to node_modules/eureca.io/examples/1-http-server/

     node client.js

you should see 'Hello from client' on the server side.

License

The MIT License (MIT)

Copyright (c) 2016 Ezelia
Author : Alaa-eddine KADDOURI

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.