diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fe96e2..7ca0fc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,20 @@ All notable changes to this project will be documented in this file. `Space Bunny Node SDK` adheres to [Semantic Versioning](http://semver.org/). -- `0.1.x` Releases - [0.1.0](#210) +- `0.1.x` Releases - [0.1.0] +- `0.2.x` Releases - [0.2.0] --- +## [0.2.0](https://github.com/space-bunny/node-sdk/releases/tag/v0.2.0) + +#### Added + +- Ack / Nack handling for STOMP clients +- support for DiscardMine and DiscardFromApi options + +## [0.1.0](https://github.com/space-bunny/node-sdk/releases/tag/v0.1.0) + #### Added - AMQP, STOMP, MQTT clients - AMQP, STOMP, MQTT stream clients - -## [0.1.0](https://github.com/space-bunny/releases/tag/0.1.0) diff --git a/README.md b/README.md index 054b0d1..67f5907 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Please feel free to contribute! `npm install spacebunny --save` -## Usage +## Basic usage ### Device @@ -60,12 +60,16 @@ amqpClient.onReceive(messageCallback).then(function(res) { }); ``` -For more advanced usage please refer to example files +For more advanced usage please refer to example files in `examples` folder ### Stream A stream client can read from multiple live streams hooks -In this example the streamer receives all messages from stream `my-stream` + +#### AMQP streamer + +In this example the streamer receives all messages from stream `my-stream` and `my-stream-2` + ```javascript 'use strict'; var AmqpStreamClient = require('spacebunny').AmqpStreamClient; @@ -82,6 +86,7 @@ var streamClient = new AmqpStreamClient(connectionParams); // Use your stream name var streamHooks = [ { stream: 'my-stream', callback: messageCallback }, + { stream: 'my-stream-2', callback: messageCallback } ]; streamClient.streamFrom(streamHooks).then(function(res) { console.log(res); @@ -89,8 +94,75 @@ streamClient.streamFrom(streamHooks).then(function(res) { console.error(reason); }); ``` +For more advanced usage please refer to example files in `examples` folder + +## Usage within a web page + +Space Bunny Node SDK is bundled using Webpack to allow the integration of the library within a web page + +### Device + +#### STOMP receiver and publisher + +In this example a device waits for incoming messages on its `inbox` channel and publishes a single message on the first configured channel + +```html + + +``` + +For more advanced usage please refer to example files in `dist` folder + +### Stream + +A stream client can read from multiple live streams hooks + +#### STOMP streamer + +In this example the streamer receives all messages from stream `my-stream` and `my-stream-2` + +```html + + +``` -For more advanced usage please refer to example files +For more advanced usage please refer to example files in `dist` folder ## Watch changes to src files (with automatic transpilation on save) diff --git a/config/constants.js b/config/constants.js index 3a3ea65..de0c1bb 100644 --- a/config/constants.js +++ b/config/constants.js @@ -18,13 +18,13 @@ exports.CONFIG = { ssl: { secureProtocol: 'TLSv1_method' }, - ackTypes: ['auto', 'manual'], - inputExchange: 'input', + fromApiHeader: 'x-from-sb-api', protocol: 'amqp', inboxTopic: 'inbox', liveStreamSuffix: 'live_stream', tempQueueSuffix: 'temp', amqp: { + ackTypes: ['auto', 'manual'], protocol: 'amqp', ssl: { protocol: 'amqps' @@ -51,6 +51,7 @@ exports.CONFIG = { } }, stomp: { + ackTypes: ['client'], connection: { headers: { max_hbrlck_fails: 10, @@ -65,6 +66,7 @@ exports.CONFIG = { } }, webStomp: { + ackTypes: ['client'], webSocket: { protocol: 'ws', ssl: { diff --git a/dist/device/index.html b/dist/device/index.html index 89611d5..9d88e51 100644 --- a/dist/device/index.html +++ b/dist/device/index.html @@ -67,7 +67,6 @@