v0.44.0 - [🚨BREAKING] - Add a new way of using websockets - implement broadcasts and sends
What's Changed
- fix: websockets by @sansyrox in https://github.com/sparckles/Robyn/pull/620
- docs: add docs for request.json by @sansyrox in https://github.com/sparckles/Robyn/pull/641
- docs: add docs for architecture by @sansyrox in https://github.com/sparckles/Robyn/pull/645
- docs: add docs for framework performance comparison by @sansyrox in https://github.com/sparckles/Robyn/pull/647
- docs: add docs for plugins by @sansyrox in https://github.com/sparckles/Robyn/pull/648
@websocket.on("message")
async def message(ws: WebSocketConnector, msg: str) -> str:
global websocket_state
websocket_id = ws.id
state = websocket_state[websocket_id]
resp = ""
if state == 0:
resp = "Whaaat??"
await ws.async_broadcast("This is a broadcast message")
ws.sync_send_to(websocket_id, "This is a message to self")
elif state == 1:
resp = "Whooo??"
elif state == 2:
resp = "*chika* *chika* Slim Shady."
websocket_state[websocket_id] = (state + 1) % 3
return resp
Full Changelog: https://github.com/sparckles/Robyn/compare/v0.43.0...v0.44.0