Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any JavaScript libraries or sample code for google cloud pub/sub? [closed]

I am evaluating google cloud pub/sub to send messaging to my JavaScript client application (ionic, angular app). I couldn’t find any sample code for subscribing pub/sub messaging in JavaScript.

JFYI: I have nodejs on server-side.

like image 304
Suyog Kale Avatar asked Jan 24 '17 07:01

Suyog Kale


1 Answers

There is no client library provided for Javascript. If you want to access messages from Javascript, you will have to make HTTP pull requests. In order to make these requests, they will need to be authorized. That means you would have to have making OAuth2 access token requests for a service account from your client application.

In general, Google Cloud Pub/Sub is not going to be the best way to send messages from a server to client applications that are run by your users unless you have very tight control over who the users are that are accessing the app. Additionally, since there is a limit of 10,000 subscriptions in Google Cloud Pub/Sub, you could only ever have 10,000 users receive the full stream of messages. Instead, you might want to consider Firebase Cloud Messaging for this type of use case.

like image 198
Kamal Aboul-Hosn Avatar answered Oct 11 '22 13:10

Kamal Aboul-Hosn