简体   繁体   English

使用Chrome扩展程序中的Google Cloud Pub / Sub

[英]Using Google Cloud Pub/Sub from Chrome extension

In my current project we are already using Google Pub/Sub: cloud.google.com/Pub_Sub‎ 在我当前的项目中,我们已经在使用Google Pub / Sub:cloud.google.com/Pub_Sub

Now, we also need to create a Chrome extension, which will be sending some information for each url (of a specific domain). 现在,我们还需要创建一个Chrome扩展程序,它将为(特定域的)每个URL发送一些信息。 Extension does not need to receive anything. 扩展程序不需要接收任何东西。 I was wondering if pub/sub is a good idea for this? 我想知道pub / sub是否是个好主意? (is it even possible?) Or should I create a web-service for this. (甚至有可能吗?)或者我应该为此创建一个Web服务。

If it is possible, could someone please point me to any existing application, which does it? 如果可能的话,有人可以指出我现有的任何应用程序吗?

I am new to pub/sub. 我是pub / sub的新手。

The actual publishing probably shouldn't be done through the extension. 实际的发布可能不应该通过扩展名来完成。 This is because you'll need to distribute the app and you can't include the credentials you need for authenticating to Cloud Pub/Sub. 这是因为您需要分发应用程序,并且无法包含向Cloud Pub / Sub进行身份验证所需的凭据。

Instead, you should create a separate service, perhaps a serverless setup using Cloud Run or Cloud Functions that handle requests from the chrome extension and deals with authentication automatically. 相反,您应该创建一个单独的服务,也许是使用Cloud RunCloud Functions的无服务器设置,这些服务可以处理chrome扩展程序的请求并自动处理身份验证。 Those functions can then publish to Cloud Pub/Sub. 然后可以将这些功能发布到Cloud Pub / Sub。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM