how to expose my own http port and keep the custom HTTP response?
I want to use my own function and image directly. But I cannot find any guides about how to define a function without SDK runpod-python. Like how to let RunPod know which port to access?how to let RunPod directly return the http response?
12 Replies
Hi there, we currently do not support options for this at the moment
Thanks for your reply. So if I can expose the http port by env RUNPOD_REALTIME_PORT in serverless Endpoint config?
Hi there Smile, could you clairfy your comment here further please?
In the serverless Endpoint creation page, I found that the "environment variables" can be added. Also, from SDK, the port can be set by RUNPOD_REALTIME_PORT. So I wonder if we can set the custom http port by it.
def _get_realtime_port() -> int:
"""
Get the realtime port from the environment variable if it exists.
"""
return int(os.environ.get("RUNPOD_REALTIME_PORT", "0"))
Also, I want to simulate the URL path "/realtime" in my own function, so I just need to change a little codes to deploy my own function in RunPod. I'm not sure if this can work since the reponse structure is different.
You mean get the port
yeah, this should work
Does RunPod need to analyze the response from my function ? Because the response structure is different.
+
96+
I would recommend trial/error here, but I don't believe so
I will try if it works. Thanks.
Hi guys, any luck getting the /realtime endpoint to work?
network ports are now allowed on serverless workers so should be possible.
Oh really?? I'll try it now, thanks!
Thank you @Encyrption, you saved me a lot of struggle 😄