removed.
This commit is contained in:
parent
0072e6d86e
commit
d74e68d593
@ -154,20 +154,16 @@ class Application(BaseApplication):
|
|||||||
self.router.add_get("/ws/{uuid}", self.websocket_handler)
|
self.router.add_get("/ws/{uuid}", self.websocket_handler)
|
||||||
|
|
||||||
async def websocket_handler(self, request):
|
async def websocket_handler(self, request):
|
||||||
# Extract the UUID from the route
|
|
||||||
uuid_value = request.match_info["uuid"]
|
uuid_value = request.match_info["uuid"]
|
||||||
|
|
||||||
# Validate if it's a valid UUID
|
|
||||||
try:
|
try:
|
||||||
uuid_obj = uuid.UUID(uuid_value)
|
uuid_obj = uuid.UUID(uuid_value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return web.Response(text="Invalid UUID", status=400)
|
return web.Response(text="Invalid UUID", status=400)
|
||||||
|
|
||||||
# Upgrade the connection to WebSocket
|
|
||||||
ws = web.WebSocketResponse()
|
ws = web.WebSocketResponse()
|
||||||
await ws.prepare(request)
|
await ws.prepare(request)
|
||||||
|
|
||||||
print(f"WebSocket connection established with UUID: {uuid_obj}")
|
|
||||||
component = App(self, "app", ws=ws)
|
component = App(self, "app", ws=ws)
|
||||||
await component.service()
|
await component.service()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user