rpc-duplex-node

0.1.4 • Public • Published

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'/>

Readme

Keywords

none

Package Sidebar

Install

npm i rpc-duplex-node

Weekly Downloads

7

Version

0.1.4

License

none

Last publish

Collaborators

  • dpweb