0.1.1 • Published 9 years ago

oz-web v0.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

oz-web

Build Status

oz's web components

// server.js
var ozweb = require('oz-web')
var server = ozweb.server(2332)

server.in()
  .each(console.log)
  .done()

setInterval(function() {
  server.out().put(23)
}, 500)
// client.js
var client = ozweb('ws://localhost:2332')

client.in()
  .tap(sig.log)
  .map(function(v) { return v + 1 })
  .to(client.out())

example

browser client

$ bower install oz-msg

node.js server / node.js client

$ npm install oz-msg

usage

browser client

For bundling systems supporting commonjs, oz-web.client is accessible via require('oz-web/client').

The client is also accessible via one of the build/ files:

  • oz-web.js: the client library without its dependencies
  • oz-web.all.js: the client library with its dependencies bundled
  • oz-web.min.js: the minified client library
  • oz-web.all.js: the minified cliebt library with its dependencies bundled

If no module system is found, the client library is exposed as the global ozweb.

nodejs client

require('oz-web').client or require('oz-web/client')

nodejs server

require('oz-web').server

api

ozweb.server(port)

Creates an oz-web server and tells its underlying engine.io Server to listen on the given port.

ozweb.server(httpServer)

Creates an oz-web server and tells its underlying engine.io Server to attach to the given httpServer.

server.in()

Returns the server's input sig.

server.out()

Returns the server's output sig.

ozweb.client(addr)

Creates a client socket connected to the address addr.

client.in()

Returns the clients's input sig.

client.out()

Returns the clients's output sig.