Skip to content

dustydecapod/promise.io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fancy RPC library using socket.io and promises!

Circle CI

Design Decisions

CoffeeScript

Promise.IO is written in CoffeeScript, and as such its API is geared towards usage in CoffeeScript. Where possible, helper utilities are provided to make it easier for pure JavaScript usage -- but keep in mind that pure JavaScript is treated as a second-class citizen in Promise.IO.

Promises

Promise.IO makes gratuitous use of Promises, because let's face it -- callbacks suck. In particular, the lightweight and efficient Q library is used. Promises let you do really cool things, like not have to live in callback hell all your life. You can also set timeouts on your RPC calls! Your calls can even use .notify() promise functions to get progress notifications from the remote, in the same way you would with local promises.

CoffeeScript Server Example

server = new PromiseIO {
  someFunc: (input) ->
    return 'I got: ' + input
}

server.listen 3000

CoffeeScript Client Example

client = new PromiseIO

client.connect 'http://localhost:3000'
  .then (remote) ->    remote.someFunc 'my variable!'
      .then (returnVal) -> console.log returnVal
      .catch (err) -> console.log err

About

RPC library using promises and socket.io

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •