-
Notifications
You must be signed in to change notification settings - Fork 200
[RFC]: Add support for WebSocketSpec #467
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
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #467 +/- ##
===================================
- Coverage 89% 87% -2%
===================================
Files 37 39 +2
Lines 2158 2227 +69
===================================
+ Hits 1913 1932 +19
- Misses 245 295 +50 🚀 New features to boost your workflow:
|
for more information, see https://pre-commit.ci
…e into feat/add-websocket-spec
Hey @bhimrazy, great work adding WebSocket support! 🙌 That said, I noticed that the current implementation still follows the same old flow: Right now, we’re still treating the WebSocket like a regular HTTP call, just over a different pipe. It works, but we’re not unlocking the real benefits yet. |
Thanks for the thoughtful feedback, @aniketmaurya ! 🙏 |
What does this PR do?
This PR introduces an experimental
WebSocketSpec
for enabling communication using WebSockets in LitServe.It aims to address the limitation of current server-sent events (SSE)-based streaming by supporting streaming input and output, which is critical for real-time AI use cases such as:
etc
This PR sets the foundation for broader real-time interaction patterns in LitServe, inspired by community discussions in #320.
Fixes #320
Before submitting
🔧 Usage
Here’s how to use
WebSocketSpec
for real-time object detection with an RFDETR model.Click to expand: Object Detection Example
Install requirements
🖥️
server.py
📡
client.py
⚡ Benchmarks
I performed a basic performance comparison between
WebSocketSpec
and existing HTTP-based inferencing methods on a video inference workload.Details:
rfdetr
)1. Using HTTP Requests
Start the server
Script
2. Using Websocket Requests
Start the server from usage section using
WebSocketSpec
.Script
🎥 Output Video
output_ws.mp4
PR review
Community feedback is welcome! This is an experimental addition and we’d love help shaping it to best serve real-time ML use cases.
Did you have fun?
Yes 😄 — and more to come!