Javascript Protocol Framework
A protocol is a contract between different entities on how they go about their
communication. This library is a framework, built in javascript, to facilitate
building such contract.
Installation
npm install javascript-protocol-framework
Example
// Server-side protocol
protocol.addReceiver('ping', function(message) {
message.reply('pong');
});
// Client-side session
session.send({type: 'ping'}, function(message) {
message.data === 'pong'
})
Goals
- Allow simultaneous multi-step communication
- Memory-efficient enough for server-side usage
- Must work cross platform (NodeJS, browser)
- Make business logic independend from the used transportation layer
Documentation
See the 'full' implementation of the
json-tcp module
for an example.
Test
To start the mocha test suite:
grunt test
Browser-testing:
zuul --local 8000 test/_test.js
zuul -- test/_test.js
License
MIT