Node Client
The Nymph Node Client lets you do everything the Nymph Client does, but from Node.JS instead of the browser.
Installation
npm install --save @nymphjs/client-node
This package is the Nymph client for Node.js. You can find CJS in dist
, or TS source in src
. There is also a
browser client.
This package provides fetch and WebSocket ponyfills to Nymph and handles Tilmeld auth tokens.
Usage
To use, require it instead of @nymphjs/client
:
const { Nymph, PubSub } = require('@nymphjs/client-node');
Then set up Nymph and PubSub like normal:
const nymphOptions = {
restUrl: 'https://yournymphrestserver/path/to/your/endpoint',
pubsubUrl: 'wss://yournymphpubsubserver',
};
const nymph = new Nymph(nymphOptions);
const pubsub = new PubSub(nymphOptions, nymph);