mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
fix theme data not being sent when all Bonsai's are disconnected
This commit is contained in:
@@ -38,9 +38,9 @@ class WebNamespace(socketio.AsyncNamespace):
|
||||
|
||||
async def on_connect(self, sid, environ):
|
||||
print(f"Web client connected: {sid}")
|
||||
await sio.emit("theme_data", blender_theme, namespace="/web", room=sid)
|
||||
if blender_messages:
|
||||
await sio.emit("connected_clients", list(blender_messages.keys()), namespace="/web", room=sid)
|
||||
await sio.emit("theme_data", blender_theme, namespace="/web", room=sid)
|
||||
await self.send_cached_messages(sid)
|
||||
|
||||
async def on_disconnect(self, sid):
|
||||
@@ -71,6 +71,7 @@ class WebNamespace(socketio.AsyncNamespace):
|
||||
if "demo_data" in messages:
|
||||
await self.emit("demo_data", {"blenderId": blenderId, "data": messages["demo_data"]}, room=sid)
|
||||
|
||||
|
||||
# Blender namespace
|
||||
class BlenderNamespace(socketio.AsyncNamespace):
|
||||
def __init__(self, namespace):
|
||||
@@ -115,8 +116,7 @@ class BlenderNamespace(socketio.AsyncNamespace):
|
||||
blender_theme = data
|
||||
await sio.emit("theme_data", data, namespace="/web")
|
||||
|
||||
|
||||
# this function will be called when the event demo_data is emitted
|
||||
# this function will be called when the event demo_data is emitted
|
||||
async def on_demo_data(self, sid, data):
|
||||
print(f"Demo data from Blender client {sid}")
|
||||
blender_messages[sid]["demo_data"] = data
|
||||
|
||||
Reference in New Issue
Block a user