attempting proxying

This commit is contained in:
2025-12-09 16:01:26 -05:00
parent 44e35771fa
commit 18e8fdb0a3

View File

@@ -2,6 +2,7 @@ import json
import queue
import uuid
from typing import Dict, Any
import logging
from flask import Response
@@ -9,6 +10,7 @@ from events.types.event import Event
# Maps user_id → dict of {connection_id: queue}
user_queues: Dict[str, Dict[str, queue.Queue]] = {}
logging.basicConfig(level=logging.INFO)
def get_queue(user_id: str, connection_id: str) -> queue.Queue:
@@ -53,6 +55,8 @@ def sse_response_for_user(user_id: str):
while True:
# Get message from queue (blocks until available)
message = user_queue.get()
logging.info(
f"Sending SSE message to user {user_id} (connection {connection_id}): {message.decode('utf-8').strip()}")
yield message
except GeneratorExit:
# Clean up when client disconnects