|
|
@ -45,30 +45,27 @@ class EventStreamRestServlet(ClientV1RestServlet): |
|
|
|
raise SynapseError(400, "Guest users must specify room_id param") |
|
|
|
raise SynapseError(400, "Guest users must specify room_id param") |
|
|
|
if "room_id" in request.args: |
|
|
|
if "room_id" in request.args: |
|
|
|
room_id = request.args["room_id"][0] |
|
|
|
room_id = request.args["room_id"][0] |
|
|
|
try: |
|
|
|
|
|
|
|
handler = self.handlers.event_stream_handler |
|
|
|
handler = self.handlers.event_stream_handler |
|
|
|
pagin_config = PaginationConfig.from_request(request) |
|
|
|
pagin_config = PaginationConfig.from_request(request) |
|
|
|
timeout = EventStreamRestServlet.DEFAULT_LONGPOLL_TIME_MS |
|
|
|
timeout = EventStreamRestServlet.DEFAULT_LONGPOLL_TIME_MS |
|
|
|
if "timeout" in request.args: |
|
|
|
if "timeout" in request.args: |
|
|
|
try: |
|
|
|
try: |
|
|
|
timeout = int(request.args["timeout"][0]) |
|
|
|
timeout = int(request.args["timeout"][0]) |
|
|
|
except ValueError: |
|
|
|
except ValueError: |
|
|
|
raise SynapseError(400, "timeout must be in milliseconds.") |
|
|
|
raise SynapseError(400, "timeout must be in milliseconds.") |
|
|
|
|
|
|
|
|
|
|
|
as_client_event = "raw" not in request.args |
|
|
|
as_client_event = "raw" not in request.args |
|
|
|
|
|
|
|
|
|
|
|
chunk = yield handler.get_stream( |
|
|
|
chunk = yield handler.get_stream( |
|
|
|
requester.user.to_string(), |
|
|
|
requester.user.to_string(), |
|
|
|
pagin_config, |
|
|
|
pagin_config, |
|
|
|
timeout=timeout, |
|
|
|
timeout=timeout, |
|
|
|
as_client_event=as_client_event, |
|
|
|
as_client_event=as_client_event, |
|
|
|
affect_presence=(not is_guest), |
|
|
|
affect_presence=(not is_guest), |
|
|
|
room_id=room_id, |
|
|
|
room_id=room_id, |
|
|
|
is_guest=is_guest, |
|
|
|
is_guest=is_guest, |
|
|
|
) |
|
|
|
) |
|
|
|
except: |
|
|
|
|
|
|
|
logger.exception("Event stream failed") |
|
|
|
|
|
|
|
raise |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defer.returnValue((200, chunk)) |
|
|
|
defer.returnValue((200, chunk)) |
|
|
|
|
|
|
|
|
|
|
|