
The Chips Got Faster. The Stack Didn't.
The bottleneck has moved.
Blog
This follow-up to our “Hello World” tutorial walks through streaming output from a Runpod Serverless endpoint using WebSocket and base64 files.

In this followup to our 'Hello World' tutorial, we'll create a serverless endpoint that processes base64-encoded files and streams back the results. This will demonstrate how you can work with file input/output over our serverless environment by encoding the file as data within a JSON payload.
As before, this tutorial will be aimed at OSX developers.
Create your development environment.
Create a new file called handler.py. Remember that the handler loop is how code gets executed when a worker is active. In this example, this handler will simulate image processing. Since this tutorial is to demonstrate the serverless environment more than process images, we will have it just create a static, blank image as the payload.
As with the previous tutorial, we'll need to provide the Dockerfile and requirements.txt to build and push the image.
As before, build and push your image to DockerHub, and then pull it into your endpoint.

Here, we'll provide an example of how to interact with the endpoint in code. You'll need to provide your Runpod API key and Endpoint ID in the variables up top. Let's call this test_endpoint.py.
What this code will do is send a request to the endpoint you've created, let it process and return base64 data in a JSON payload, and return it to your script for further local processing and saving.
Run the test:
You should see output like this, along with a base64 JSON payload saved in the folder you ran the script in.
You've now learned how to create a Runpod serverless endpoint that can process base64-encoded files and stream results back to the client. This pattern can be extended to handle various types of file processing tasks while providing real-time feedback to users.
Author profile: Brendan McKeag
Blog Posts

The bottleneck has moved.
.jpeg)
With MIG, we can partition RTX 6000 Pro cards into isolated 24 GB instances. Here's when it makes sense for your workloads.
.jpeg)
How 1,100 researchers beat OpenAI's own baseline with 16 megabytes and 10 minutes.