-
Notifications
You must be signed in to change notification settings - Fork 292
feat: experimental defineWebSocketRoute #1149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Deploying h3dev with
|
| Latest commit: |
fd6f13d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://71a3c637.h3dev.pages.dev |
| Branch Preview URL: | https://feat-definewebsocketroute.h3dev.pages.dev |
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
| /** | ||
| * Additional route metadata | ||
| */ | ||
| meta?: Record<string, unknown>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Middleware and meta are not supported. Types should be removed (at least untill they are supported by defineWebSocket
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should take the comment line and leave a TODO ?
| /** | ||
| * HTTP method for the route (typically 'GET' for WebSocket upgrades) | ||
| */ | ||
| method?: HTTPMethod; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WebSocket handlers should not accept a method.
Summary
cc: #1088
cc: #1138
defineWebSocketRouteutility function to simplify WebSocket route definitionsWebSocketRouteDefinitioninterface for type-safe WebSocket route configurationDescription
This PR introduces a new
defineWebSocketRoutefunction that provides a consistent API pattern withdefineRoutefor defining WebSocket endpoints. This makes it easier to create WebSocket routes as plugins that can be registered withapp.register().Example usage:
Test plan
app.register()