rpc-duplex-node

Client rpc for nodejs

npm install rpc-duplex-node
7 downloads in the last week
28 downloads in the last month

rpc-duplex-node

Simple rpc for node/express. Uses websocket if browser supported, else polling.

Like this..

app.js

    var express = require('express'), app = express();
    var server = require('http').createServer(app)
     server.listen(85);


     var allin = require('./rpc-duplex-node.js')(app);
     allin.log = console.log;

     // Send some calls to the clients using clientcall()
     function doit(){
         allin.clientcall('document.getElementById("timeis").innerHTML=new Date()')
     }
     setInterval(doit, 1000);


     app.get('/', function(r,s){
         s.sendfile('index.html')
     })

index.html

<!-- include the script -->
<script src='/rpc'></script>

<div id='timeis'/>
npm loves you