简体   繁体   English

Google Cloud App Engine(python):从device1接收帖子并将帖子发送到设备2

[英]Google Cloud App Engine (python): Receiving a post from device1 and sending a post to device 2

I have a Google Cloud project with consists in a SQL database and App Engine in python 2.7. 我有一个Google Cloud项目,其中包含一个SQL数据库和python 2.7中的App Engine。

Up to know what I have done is from a RaspberryPi send a post to App Engine and save data in the Cloud. 知道我所做的是从RaspberryPi发送帖子到App Engine并将数据保存在Cloud中。 At the same time this RasPi was able to receive data from the Cloud or App Engine thanks to the code: self.response.write(jsondata). 同时,借助以下代码,该RasPi能够从Cloud或App Engine接收数据:self.response.write(jsondata)。 This works fine. 这很好。

Now I introduced a new device in the system, which I will call Raspi2. 现在,我在系统中引入了一个新设备,称为Raspi2。 Raspi 1, sends a command to App Engine, and I want App Egine to send this command to Raspi2, without Raspi2 needs to ask peridically the cloud, to avoid delay. Raspi 1,向App Engine发送命令,我希望App Egine将此命令发送至Raspi2,而Raspi2不需要定期询问云,以避免延迟。 Is there a way of telling AppEngine to send a message to another device, how? 有没有一种方法告诉AppEngine将消息发送到另一台设备,该如何做? Or if not App Engine, that when an specific field in the SQL table has changed, triggers a message to be sent to Raspi3, without Polling. 或者如果不是App Engine,则当SQL表中的特定字段发生更改时,会触发一条消息发送到Raspi3,而不会进行轮询。 I don't know if it possible to do it, I have read about Google cloud Messaging, but I don't know if it applies to this case. 我不知道是否有可能这样做,我已经阅读了有关Google云消息传递的信息,但是我不知道它是否适用于这种情况。

Thanks 谢谢

This is called a server push to a client. 这称为服务器推送到客户端。 App engine used to have a channel api that allowed you to do this but it has now been deprecated and might not be available at all. App Engine曾经具有允许您执行此操作的通道api ,但现在已弃用该功能,可能根本不可用。

Firebase realtime database is the recommended replacement. 建议使用Firebase实时数据库

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

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