Low-level library to generate WebSocket URLs for serverless applications using AWS IoT and Cognito identity pools. Current stable version is 1.0.1 (last release). Release cadence is unknown; repository appears inactive with no recent commits. Key differentiators: provides a lightweight, minimal way to obtain a WebSocket URL suitable for MQTT over WebSockets, targeting browser and Node.js. Unlike full-service alternatives like Pusher or Ably, it focuses only on AWS IoT connectivity, leaving the MQTT client choice to the user.
npm install serverless-websocketNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a WebSocket URL using AWS IoT and Cognito, with environment variables for configuration.
Install crypto-browserify and set up webpack/browserify shims.
Use an MQTT-over-WebSocket client like mqtt.js (browser-compatible) to connect to the URL.
Ensure you use the 'iotEndpoint' from the Cognito identity pool's 'Connect to IoT' page, or the endpoint returned by AWS CLI.
Migrate to aws-mqtt (https://github.com/kmamykin/aws-mqtt) or AWS Amplify's PubSub module.
Install and configure crypto-browserify as a polyfill for the browser.
Provide a valid AWS account ID (12-digit number) as the 'accountID' property.
Ensure identityPoolID follows the pattern '<region>:<UUID>'.
Verify that the identity pool is configured to allow unauthenticated access or provide proper credentials.