aws / aws/aws-pdk

[FEATURE] (type-safe-api) WebSocket API support for Python

Open
#741 3 comments 1 reaction 0 assignees View on GitHub
backlog feature-request needs-triage
Dominant language
TypeScript
Stars
451
Forks
84
Avg merge
20h 3m
Merged PRs (30d)
1

Description

### Describe the feature

Add support for WebSocket APIs in Python

### Use Case

Consistency with remainder of PDK

### Proposed Solution

Need to add the following:

- [ ] Runtime: operation handler wrappers
- [ ] Runtime: @connect/@disconnect handler wrappers
- [ ] Runtime: interceptors
- [ ] Runtime: server sdk (wrapping API Gateway Management API SDK)
- [ ] Infrastructure
- [ ] Handler stubs
- [ ] @connect/@disconnect handler stubs
- [ ] WebSocket client library
- [ ] Integration with `InfrastructurePyProject`

### Other Information

The majority of scaffolding is there already for runtime/handlers/infra - the mustache templates for the `python-async-xxx` projects in [`packages/type-safe-api/scripts/generators`](https://github.com/aws/aws-pdk/tree/mainline/packages/type-safe-api/scripts/type-safe-api/generators) are copy/pasted REST API implementations that need to be modified to work for websockets.

The projen projects (eg [generated-python-async-runtime-project.ts](https://github.com/aws/aws-pdk/blob/mainline/packages/type-safe-api/src/project/codegen/runtime/generated-python-async-runtime-project.ts)) will likely need to be tweaked slightly to add any dependencies required.

The client library will need to be added - follow the same pattern as the TypeScript websocket client library.

Make sure to remove the validation check once implemented: https://github.com/aws/aws-pdk/blob/a0dda50691a756798521dd1c8cbf0d5c21bdc9d2/packages/type-safe-api/src/project/type-safe-websocket-api-project.ts#L226

### Acknowledgements

- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### PDK version used

0.23.26

### What languages will this feature affect?

Python

### Environment details (OS name and version, etc.)

OSX

Contributor guide

Open the contributing guide

Research direction

Start with the existing Python async REST templates under packages/type-safe-api/scripts/type-safe-api/generators and generated-python-async-runtime-project.ts, then compare them with the TypeScript WebSocket client pattern. Trace the validation check in type-safe-websocket-api-project.ts and identify the runtime, infrastructure, stubs, client, and InfrastructurePyProject changes listed in the issue. Done means Python WebSocket generation covers the full checklist and the validation check is removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python, typescript
Domain
api, backend, cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.