Node.JS
River is available as an npm package. In your project's root, type:
npm install river-http-node
Requiring the module exposes the River constructor:
const River = require("river-http-node");
To configure the server, use the River constructor:
const river = new River({
host: "localhost", // API Gateway endpoint
key: "apikey", // API Gateway key
});
The endpoint and key are given at the end of the deployment process. Please see the deploy
repo for more information.
To publish a message from your backend, use the publish
method:
river.publish("channel", "eventName", data);
This sends an HTTP POST request to River. data
can be a string, array, or object. See the client-js
repo for how clients receive this event data.
For more examples, see the examples
repo.
MIT