juttle-jsdp
v0.3.0
Published
Juttle Streaming Data Protocol
Downloads
34
Readme
juttle-jsdp
The implementation of the Juttle Streaming Data Protocol (JSDP) used by the components of Project Juttle to send data and metadata between the server (juttle-service) and client (juttle-client-library) components.
Getting started
Node.js
Note: momentjs is a peerDependency.
$ npm install juttle-jsdp
let JSDP = require('juttle-jsdp');
console.log(JSDP.serialize({time: new Date(2000)}));
Browser
Note: momentjs is expected as an external dependency so be sure its available globally.
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.11.1/moment.js"></script>
<script type="text/javascript" src="dist/juttle-jsdp.js">
JuttleJSDP.serialize({time: new Date(2000)});
</script>
API
JSDP.serialize(value)
Serializes the given object to JSON.
JSDP.deserialize(data)
Deserializes the given JSON and returns an object that has "value equality" with original serialization target.