0us5ama
0us5ama
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
Yes the same issue persists
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
I added it to my github repo and redeployed the app but the connection keep-alive was not added
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
ok one minute
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
yes
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
"gunicorn -b 0.0.0.0:8000 main:app --worker-class gevent" this is my startup command
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
yeah that's highly probably since I didn't use it in the dev process.
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
this is the part of my code responsible for sse. Is there anything here that maybe causing the connection restarting when hosted in railway?
@app.get("/sse")
def sse():
if "text/event-stream" not in request.accept_mimetypes:
abort(400)
def send_events():
nonlocal variable
while True:
event_binary = b''
if condition:
data = ...
_event = ...
event = ServerSentEvent(data, _event)
event_binary = event.encode()
yield event_binary
time.sleep(0.1)

response = Response(
send_events(),
mimetype="text/event-stream",
)
response.timeout = None
return response
@app.get("/sse")
def sse():
if "text/event-stream" not in request.accept_mimetypes:
abort(400)
def send_events():
nonlocal variable
while True:
event_binary = b''
if condition:
data = ...
_event = ...
event = ServerSentEvent(data, _event)
event_binary = event.encode()
yield event_binary
time.sleep(0.1)

response = Response(
send_events(),
mimetype="text/event-stream",
)
response.timeout = None
return response
maybe this if "text/event-stream" not in request.accept_mimetypes: abort(400)?
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
okey
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
locally?
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
in any case I should have answered directly
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
I didn't answer you first straight forwardly
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
I was just confused if you were familiar with the topic. This is my fault sorry
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
it's a get request to the sse endpoint which makes the connection with the server and keeps it alive until the client aborts
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
okey sorry
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
it's like a websocket
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
it's an event stream
43 replies
RRailway
Created by 0us5ama on 6/29/2023 in #✋|help
SSE connections timeout each 5 minutes
87705bfd-1f41-4d43-8e4d-ed1380fbc20e
43 replies