[英]how to connect with azure service bus topic with javascript
I am creating a mobile application with cordova(phone gap). 我正在创建一个带有cordova(手机间隙)的移动应用程序。 I would like my app to talk with an azure service bus to post messages to a topic and read messages from a subscription.
我希望我的应用程序能够与天蓝色的服务总线交谈,将消息发布到主题并从订阅中读取消息。
I have found all kinds of details on how to do this with c#, java, python, node.js. 我已经找到了有关如何使用c#,java,python,node.js执行此操作的各种详细信息。 However I haven't found any details on how to do this with pure javascript.
但是我没有找到任何有关如何使用纯javascript执行此操作的详细信息。
Is this possible? 这可能吗? or must I use Azure mobile services and configure it to communicate with the service bus?
或者我必须使用Azure移动服务并将其配置为与服务总线通信?
CORS - Cross-Origin Resource Sharing is now supported in windows azure for storage ,table and queues. CORS - Windows Azure中现在支持存储,表和队列的跨源资源共享。 So you access the REST api of these from javascript.
所以你从javascript访问这些REST api。 Topics and Subscriptions are not mentioned here though.
但是这里没有提到主题和订阅。 http://msdn.microsoft.com/en-us/library/windowsazure/dn535601.aspx Also if you have not already check out Azure notification hubs which may help in your requirement.
http://msdn.microsoft.com/en-us/library/windowsazure/dn535601.aspx此外,如果您还没有查看可能有助于您的要求的Azure通知中心。 But mostly for notifications to cross platform devices.
但主要用于跨平台设备的通知。
您可以使用REST API将消息排入主题: http : //msdn.microsoft.com/en-us/library/windowsazure/hh780786.aspx
Microsoft provides Service Bus REST API Microsoft提供Service Bus REST API
https://msdn.microsoft.com/en-us/library/azure/hh780717.aspx https://msdn.microsoft.com/en-us/library/azure/hh780717.aspx
Microsoft provides two ways to authenticate Microsoft提供了两种身份验证方法
1. Azure Active Directory ( Cordova project sample that uses AD) 1. Azure Active Directory(使用AD的Cordova项目示例 )
2. Using certificates 2.使用证书
If you want to do it using certificates, you need to generate the .cer and .pem files and upload the .cer file to your Azure portal -> Settings -> Management Certificate 如果要使用证书执行此操作,则需要生成.cer和.pem文件并将.cer文件上载到Azure门户 - >设置 - >管理证书
You can then trigger a http request by passing your .pem file to authenticate your application 然后,您可以通过传递.pem文件来验证应用程序来触发http请求
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.