{"id":49336,"library":"serverless-websocket","title":"serverless-websocket","description":"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.","status":"abandoned","version":"1.0.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install serverless-websocket","lang":"bash","label":"npm"},{"cmd":"yarn add serverless-websocket","lang":"bash","label":"yarn"},{"cmd":"pnpm add serverless-websocket","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for signing the WebSocket URL request","package":"aws-signature-v4","optional":false}],"imports":[{"note":"Package ships TypeScript types, supports ESM.","wrong":"const Create = require('serverless-websocket').Create","symbol":"Create","correct":"import { Create } from 'serverless-websocket'"},{"note":"The package exports only a single function as default export.","wrong":"const Create = require('serverless-websocket')","symbol":"default (Create)","correct":"import Create from 'serverless-websocket'"},{"note":"Parameters are case-sensitive and must match exact property names.","wrong":"Create({ account_id: '...' })","symbol":"Create options","correct":"Create({ accountID: '123456789012', identityPoolID: 'us-west-2:...', endpoint: '...', region: 'us-west-2' })"}],"quickstart":{"code":"import Create from 'serverless-websocket';\n\nconst websocketURL = await Create({\n  accountID: process.env.AWS_ACCOUNT_ID ?? '',\n  identityPoolID: process.env.COGNITO_IDENTITY_POOL_ID ?? '',\n  endpoint: process.env.IOT_ENDPOINT ?? '',\n  region: 'us-west-2',\n});\n\nconsole.log('WebSocket URL:', websocketURL);\n// Use with MQTT client\n// const ws = new WebSocket(websocketURL, ['mqttv3.1']);","lang":"typescript","description":"Demonstrates creating a WebSocket URL using AWS IoT and Cognito, with environment variables for configuration."},"warnings":[{"fix":"Install crypto-browserify and set up webpack/browserify shims.","message":"The package depends on aws-signature-v4 which uses Node.js crypto. In browser environments, you must include a polyfill for crypto.","severity":"gotcha","affected_versions":"*"},{"fix":"Use an MQTT-over-WebSocket client like mqtt.js (browser-compatible) to connect to the URL.","message":"The library only returns a WebSocket URL; it does not handle MQTT connection or data transfer. Users must implement or use an MQTT client separately.","severity":"gotcha","affected_versions":"*"},{"fix":"Ensure you use the 'iotEndpoint' from the Cognito identity pool's 'Connect to IoT' page, or the endpoint returned by AWS CLI.","message":"The 'endpoint' parameter is the IoT endpoint from Cognito identity pool configuration, not the AWS IoT endpoint. Using the wrong endpoint will cause connection failures.","severity":"gotcha","affected_versions":"*"},{"fix":"Migrate to aws-mqtt (https://github.com/kmamykin/aws-mqtt) or AWS Amplify's PubSub module.","message":"The package is unmaintained and its dependencies may have security vulnerabilities. Consider using AWS Amplify or aws-mqtt instead.","severity":"deprecated","affected_versions":"*"}],"env_vars":null,"search_vec":"'1.0.1':26 'abli':69 'altern':65 'appear':34 'applic':14 'aw':16,74 'browser':58 'cadenc':30 'choic':81 'client':80 'cognito':19 'commit':39 'connect':76 'current':22 'differenti':41 'focus':71 'full':63 'full-servic':62 'generat':9 'ident':20 'inact':35 'iot':17,75 'javascript':85 'key':40 'last':27 'leav':77 'level':6 'librari':7 'lightweight':44 'like':66 'low':5 'low-level':4 'minim':45 'mqtt':54,79 'node.js':60 'obtain':48 'pool':21 'provid':42 'pusher':67 'recent':38 'releas':28,29 'repositori':33 'serverless':2,13 'serverless-websocket':1 'servic':64 'stabl':23 'suitabl':52 'target':57 'typescript':86 'unknown':32 'unlik':61 'url':11,51 'use':15 'user':84 'version':24 'way':46 'websocket':3,10,50,56","created_at":"2026-06-07T17:01:14.210170+00:00","updated_at":"2026-06-07T17:01:14.210170+00:00","problems":[{"fix":"Install and configure crypto-browserify as a polyfill for the browser.","cause":"Missing crypto polyfill in browser environment.","error":"TypeError: Cannot read properties of undefined (reading 'createHmac')"},{"fix":"Provide a valid AWS account ID (12-digit number) as the 'accountID' property.","cause":"The 'accountID' field was not provided or is misspelled.","error":"Error: Missing required parameter: accountID"},{"fix":"Ensure identityPoolID follows the pattern '<region>:<UUID>'.","cause":"The identity pool ID must include region prefix (e.g., 'us-west-2:...')","error":"Error: Invalid identity pool ID format"},{"fix":"Verify that the identity pool is configured to allow unauthenticated access or provide proper credentials.","cause":"Invalid or missing credentials in the Cognito identity pool.","error":"TypeError: The 'key' argument must be a Buffer or string"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"serverless-websocket","openapi_spec":null,"status_page":null,"smithery":null,"categories":["messaging"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}