Ocimar
Ocimar

Reputation: 75

How to subscribe to the Azure SignalR service in a front-end Javascript application?

I'm very new to SignalR and I'm trying to understand how to create a simple frontend application that gets notified using Azure SignalR Service.

I already have a server that uses the Azure SignalR REST API to send messages to an Azure SignalR service.

How do I get this massages in my Javascript frontend application?

Upvotes: 1

Views: 697

Answers (1)

Mohit Ganorkar
Mohit Ganorkar

Reputation: 2069

  • To use signaIIr in front end you can use hubconnectionbuider class, this class is used to create instances of hubconnection which itself is used to communicate with the signalIR.

  • The hubconnection instance communicate with signalIr by waiting for communication from the signalIr service.

  • To achieve this first we need to start service connection using startasync function then use the on function to listen to signalIr service and stopAsync function to stop the service connection.

Refer this msdoc on hubconnection and this article by Sarathlal Saseendran on this specifically for angular js

Here is a sample by david grace on this specifically for react js .

Upvotes: 0

Related Questions