-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat(gateway): websocket based streaming and client #1608
Conversation
Latency summaryCurrent PR yields:
Breakdown
Backed by latency-tracking. Further commits will update this comment. |
Codecov Report
@@ Coverage Diff @@
## master #1608 +/- ##
==========================================
- Coverage 84.82% 75.03% -9.79%
==========================================
Files 126 128 +2
Lines 6589 6713 +124
==========================================
- Hits 5589 5037 -552
- Misses 1000 1676 +676
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
||
async def decode(self, websocket: WebSocket, message: Message) -> Any: | ||
if 'text' in message or 'json' in message: | ||
self.client_encoding = 'text' |
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.
this could be a good test case to cover
im taking this branch |
# Conflicts: # .github/workflows/ci.yml # extra-requirements.txt # tests/unit/flow/test_asyncflow.py
Recreated duplicate of #1551
Gateway
Added a
StreamingEndpoint
(WS /stream) toRESTGateway
Client
Added
WebSocketClient
&AsyncWebSocketClient
to stream requests fromStreamingEndpoint
forFlow
&AsyncFlow
respectivelyFlow
Enabled websocket based clients for REST gateway
Notes & Issues:
With the current implementation, gateway is blocking, as we wait for each response to come back on the websocket(FIXED)needs
fail -Flow().add().add(needs='gateway')
(TO BE FIXED)bytes
orjson
at the gateway & the client. Hence the performance might be poor compared to gRPC.bytes
only for now. Need to add support forjson
send
&recv
in websockets when compared togrpc.async_call
- websockets-commentwsproto
library overwebsockets
with UvicornServer, which adds a new dependency to jina - This PR was never merged in uvicorn.