Skip to content

Commit 396c58a

Browse files
fix: follow asgi spec and also check if text or bytes are None (Modal fix)
We assumed when the text or bytes were None that it was a missing value, but on Modal we do see a message like that, e.g.: {'type': 'websocket.receive', 'bytes': b'...', 'text': None}}
1 parent 87186c5 commit 396c58a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

solara/server/starlette.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@ async def receive(self):
230230
fut = self.portal.spawn_task(self.ws.receive)
231231

232232
message = await asyncio.wrap_future(fut)
233-
if "text" in message:
233+
if message.get("text") is not None:
234234
return message["text"]
235-
elif "bytes" in message:
235+
elif message.get("bytes") is not None:
236236
return message["bytes"]
237237
elif message.get("type") == "websocket.disconnect":
238238
raise websocket.WebSocketDisconnect()

0 commit comments

Comments
 (0)