0
votes

I have a Azure Service Bus Topic and I want to receive the messages in realtime on a web page that uses pure Javascript.

I tried this SDK (http://developers.de/blogs/damir_dobric/archive/2015/01/26/eventhubs-support-for-azure-servicebus-javascript-sdk.aspx) but when I speed up the sending message not worked well.

I tried too REST API but not worked well too.

Exist any alternative?

Regards

2
There is no official Azure Service Bus front-end javascript SDK. Could you share the code that you have written work with Service Bus via REST API?Aaron Chen
@AaronChen-MSFT I tried JQuery GET like this to receive my messages: $.get("https://<service_bus_name>.servicebus.windows.net/<topic_name>/subscriptions/<subscription_name>/messages/head/", function(data, status) { console.log("Data: " + data + " | Status: " + status); });Jorge Rosa

2 Answers

0
votes

It requires an Authorization request header to receive the messages from a queue or subscription via REST API. The value of the header could be a SAS token or a SimpleWebToken acquired from ACS.

About how to generate a Shared Access Signature (token), you can check out this link. For request a Token from ACS, please refer to this article.

0
votes

I know it is a late reply, but just in case somebody is looking to use Azure SDK for JS libraries on a website, you need to convert your code to work inside the browser. You can do this using bundler such as rollup, webpack, parcel, etc. Refer to this bundling docs to use the @azure/service-bus library in the browsers.

High performant version 7.0.0 @azure/service-bus library based on AMQP protocol has been recently published. Refer to the links below.