I have written an app which lets the user upload an image with handwritten text and now he/she should receive the extracted text as 'normal' (digital) text.

Currently, I upload the image to a **google cloud bucket**, which then triggers a **cloud function**, that calls the vision api. The vision api then returns a `JSON` result inside of the cloud function.

Now my question: How can I send the JSON result back to the client?

* I've tried FCM but the JSON response of the `vision api` is more than 4000 bytes, so the message fails to send. (I also need the coordinates of the recognized text). Getting the following error:

```
...
errorInfo: {
    code: 'messaging/invalid-argument',
    message: 'Request contains an invalid argument.' 
}

```

* I've heared of PubSub but as they described [here](https://cloud.google.com/pubsub/docs/overview#service-to-service_vs_service-to-client_communication) , it is not a good use for *service-to-client communication*. Or is it an option never the less?

**How can I send the "big" result from my cloud function back to the client?**

Any help is greatly appreciated! Thanks for your time, if anything is unclear or missing I'm happy to add the information asap.