R
RunPod6mo ago
smile^v^

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
River Snow
River Snow6mo ago
Hi there, we currently do not support options for this at the moment
smile^v^
smile^v^OP6mo ago
Thanks for your reply. So if I can expose the http port by env RUNPOD_REALTIME_PORT in serverless Endpoint config?
River Snow
River Snow6mo ago
Hi there Smile, could you clairfy your comment here further please?
smile^v^
smile^v^OP6mo ago
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.
River Snow
River Snow6mo ago
You mean get the port yeah, this should work
smile^v^
smile^v^OP6mo ago
Does RunPod need to analyze the response from my function ? Because the response structure is different.
digigoblin
digigoblin6mo ago
+ 96+
River Snow
River Snow6mo ago
I would recommend trial/error here, but I don't believe so
smile^v^
smile^v^OP6mo ago
I will try if it works. Thanks.
inc3pt.io
inc3pt.io3mo ago
Hi guys, any luck getting the /realtime endpoint to work?
Encyrption
Encyrption3mo ago
network ports are now allowed on serverless workers so should be possible.
inc3pt.io
inc3pt.io3mo ago
Oh really?? I'll try it now, thanks! Thank you @Encyrption, you saved me a lot of struggle 😄
Want results from more Discord servers?
Add your server