JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 310
  • Score
    100M100P100Q97307F
  • License Apache-2.0

post to a connected websocket client via api gateway

Package Exports

  • aws-post-to-connection

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (aws-post-to-connection) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

aws-post-to-connection

js-standard-style build status downloads

post to a connected websocket client.

usage

const PostToConnection = require('aws-post-to-connection')

// post to same gateway
const postToSameGateway = PostToConnection(event)
await postToSameGateway({ message: 'hello' }, 'connectionId')

// post to another gateway
const postToAnotherGateway = PostToConnection({
  stage: 'stage',
  domainName: '<apiId>.execute-api.<region>.amazonaws.com'
})
await postToConnection({ message: 'hello' }, 'connectionId')

// post to local websocket server
const postToLocalhost = PostToConnection({
  stage: 'stage',
  domainName: 'localhost',
  port: 5000,
  secure: false
})
await postToConnection({ message: 'hello' }, 'connectionId')

Works locally and in a lambda function.

license

Apache License, Version 2.0