Esben von Buchwald
Esben von Buchwald

Reputation: 3122

Import external data into firestore from provider that pushes data to a websocket you open?

I have a Firestore database which I want to populate with data that is delivered by a live sports event API. This API offers to push the data, so I get new values every time some event happen in a selected game - so we don't have to pull new updates all the time.

However, the delivery method is a websocket which means, that we should open a web socket to a certain endpoint, and then we'll get the data updates.

How could we do this in Firebase? If it was just a simple webhook with an HTTP call, it would be easy to make a firebase functon that could receive the posted data.

But is it possible to do something similar with a web socket? I guess that keeping a Firebase Cloud Function running 24/7 with the web socket is not a good idea at all.

Upvotes: 0

Views: 167

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317760

What you're describing is not supported by any Firebase products, and definitely not Cloud Functions. Cloud Functions doesn't support websockets at all, nor does it support any streaming. On top of that, the max lifetime of a function is 9 minutes.

If you absolutely need websockets, consider a different backend infrastructure instead, such as App Engine.

Upvotes: 2

Related Questions