@growsari/event-gateway-client
Client library for interacting with Growsari Event Gateway
Last updated 7 months ago by prasad.riktam .
ISC · Repository · Original npm · Tarball · package.json
$ cnpm install @growsari/event-gateway-client 
SYNC missed versions from official npm registry.

Event Gateway Client

Client library for interacting with Growsari Event Gateway

Installation

Install the package using the below command:

$ npm i @growsari/event-gateway-client --save

Usage

Create EventGatway Client

Create a client by passing in clientId (for now till the service implements authentication)

let client = new EventGatewayClient('ms-loc');

Subsribe to a topic

It accepts topic name and notification url (to get the notifications)

client.subscribeToTopic(topicName, notificationUrl);

Publish message to a topic

It accepts topic name and list of messages. Each message contains event name and the payload.

client.publishMessage(topicName, [ message,..}]);

Examples:

let client = new EventGatewayClient('ms-loc');

// Subscribe to a Topic - orders
client.subscribeToTopic('orders', 'http://127.0.0.1/ms-loc/test-event-push');

// Publish Event Message to a Topic - orders
client.publishMessage('orders', [{ event: 'ORDER_CREATED', payload: { "order_id": 10, "price": 10.0 } }]);

Current Tags

  • 1.0.3                                ...           latest (7 months ago)

4 Versions

  • 1.0.3                                ...           7 months ago
  • 1.0.2                                ...           7 months ago
  • 1.0.1                                ...           7 months ago
  • 1.0.0                                ...           7 months ago
Downloads
Today 0
This Week 4
This Month 4
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |