This package has been deprecated

Author message:

Project discontinued

@hume/app-ws

0.7.2 • Public • Published

hume WS app

Websockets service application abstraction to decrease the load in the HTTP APIs for common read only requests.

For now it keeps an updated cache in memory of the needed data. All the connected clients will receive an update of the requested one in an interval.

Install

Install Node.js v8 and then:

npm i @hume/app-ws

Dependencies

  • Install the dependencies for the websockets library from your OS package manager.

Use

📝 Please visit the the example.

Client side

Two query parameters are supported:

  • token (string) - Mandatory, see the last point of this document.
  • filter (string) - To serve only the the contend under one key of the cache. (default: null)

Please visit the example.

API

👀 Full specification.

app.start(cache, token, apm) -> null

Start the LoopBack app.

  • cache (async function) - Method to get the data to serve.
  • token (string) - For now we only need basic auth to avoid automated scrappers. If not passed auth is disabled. (default: null)
  • apm (object) - Elastic APM express.js agent instance (already started).

async app.stop() -> null

Stop the websocket service, useful in tests.

Package Sidebar

Install

npm i @hume/app-ws

Weekly Downloads

0

Version

0.7.2

License

Apache-2.0

Unpacked Size

8.11 kB

Total Files

6

Last publish

Collaborators

  • abdonrd
  • ismaelrozas
  • jesusprubio