@lawcket/publisher
v0.1.4
Published
Middleware for @lawcket/websocket injects send method
Downloads
13
Maintainers
Readme
@lawcket/publisher
Middleware for @lawcket/websocket injects publish method.
Installation
yarn add @lawcket/publisher
or
npm install @lawcket/publisher
Manual client building
In normal use-cases you shouldn't need to manually build the client. @lawcket/websockets already creates a publish function once the client is connected. However, in case you want to reconstruct publish communications, the following example illustrates how to.
Example:
// non-ES6
// const { builder } = require('@lawcket/publisher');
// ES6
import { builder } from '@lawcket/publisher';
// create the communication client
const client = builder({
stage: 'test',
domainName: 'test.execute-api.us-west-2.amazonaws.com',
connectionId: 'testId',
});
// send a message
client({ foo: 'bar' }).then((res) => console.log('yay', res));