• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zappa / Zappa / 22667258745

04 Mar 2026 11:24AM UTC coverage: 72.753% (-1.0%) from 73.738%
22667258745

push

github

web-flow
Add WebSocket API Gateway support (#1428)

* Add WebSocket API Gateway support via decorators, base class, and auto-provisioned infrastructure

Introduces zappa.websocket module with @on_connect, @on_disconnect, @on_message
decorators and ZappaWebSocketServer base class for handling WebSocket connections.
Auto-detects usage and provisions WebSocket API Gateway resources via CloudFormation.

Closes #1427

* Add WebSocket support section to README

Documents decorator and base class usage, send_message helper,
auto-detection behavior, and explicit websocket_enabled setting.

* Add validation for required WebSocket route handlers

Raises WebSocketConfigurationError on first WebSocket event if handlers
are registered but $connect or $default (message) routes are missing.
$disconnect remains optional.

* Fix README TOC format to match test expectations

Restore double blank line after doctoc header comment that the
test_readmetoc test requires.

* Add ManageConnections IAM permission and remove websocket_enabled setting

Auto-detection of zappa.websocket imports makes the explicit
websocket_enabled setting redundant — removed it from cli.py and README.

Added execute-api:ManageConnections to the Lambda execution role when
WebSocket is detected, fixing send_message() AccessDeniedException
found during E2E testing.

* Update README WebSocket examples with complete app.py samples

Both decorator and base class examples now show full, copy-paste-ready
app.py files with Flask app, logging, and realistic handler bodies.

* Address PR review: bytes payload, scoped IAM, skip venvs, docstring

- send_message() now always encodes Data to bytes (utf-8)
- ManageConnections IAM ARN scoped to region/account via STS
- _detect_websocket_usage() skips venv/env/.venv directories
- ZappaWebSocketServer docstring clarifies required overrides
- Tests updated to assert bytes payloads

* Shorten WebSocket API name suffix to -ws

API Gateway V2 names are limited to 128 characters... (continued)

3343 of 4595 relevant lines covered (72.75%)

4.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.14
/handler.py


Source Not Available

The file "handler.py" isn't available on github. Either it's been removed, or the repo root directory needs to be updated.

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc