是否可以在JS脚本上接收Amazon SNS消息? [英] Is it possible to receive an Amazon SNS message on a JS script?

查看:131
本文介绍了是否可以在JS脚本上接收Amazon SNS消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在rails和/或node.js和PubNuB上使用ruby的一些选项,这是一种具有许多API的服务,因此您可以在(几乎)任何平台之间发送/接收通知。

I know some options using ruby on rails and/or node.js and PubNuB, a service that has many APIs so you can send/receive notifications between (almost) any platform.

我现在如何使用Amazon SNS从PHP发送消息以及如何在那里接收消息,但是如何在JS / jQuery脚本上接收推送通知(SNS消息)?

I now how to send messages from PHP and how to receive them there using Amazon SNS, but how can I receive a push notification (a SNS message) on a JS/jQuery script?

谢谢。

推荐答案

是的,但不是直接的,你必须在计时器......

Yes, but not directly and you'll have to poll for messages on a timer...

产品详情页在灵活标题下,您将看到当前支持的格式/传输都不能在浏览器中托管。

In the Product Details page under the heading "Flexible", you'll see that none of the currently supported formats/transports can be hosted in the browser.

但是...... Amazon SQS 是受支持的传输之一,然后可以从JavaScript访问 - 请参阅此处的示例应用程序: http://aws.amazon.com /代码/亚马逊SQS / 1254 。 (该示例显示JavaScript访问SQS)。

However... Amazon SQS is one of the supported transports, and it in turn can be accessed from JavaScript - see an example app here: http://aws.amazon.com/code/Amazon-SQS/1254. (The example shows JavaScript accessing SQS).

您必须手动轮询,因为没有推送到具有SQS的浏览器。

You'd have to manually poll though, as there is no "push" to the browser with SQS.

(或者,您可以在服务器端执行此操作,然后您可以使用可能使用的websockets将消息推送到浏览器。)

(Alternatively, you could do it all server-side, and then you could use potentially use websockets to push the messages to the browser.)

这篇关于是否可以在JS脚本上接收Amazon SNS消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆