3

I have serverless Azure Functions (NodeJs) integrated to Serverless Azure SignalR service.

I can connect with Javascript just fine to SignalR via negotiate function in Azure functions.

Connection below is initialized to my function app, which returns the signalR uri and accessToken for it, which the @microsoft/signalr library knows how to use, and it internally connects to signalR using them

const appUri: string = process.env.FUNCTION_APP_URI as string
const connection: HubConnection = new HubConnectionBuilder()
  .withUrl(appUri)
  .build()
connection.on('newMessage', (message) => console.log(message))
connection.start()
  .then(() => console.log('SignalR listener started.'))
  .catch(console.error)

Everything works fine.

But how do I do the same from a .Net Core console app?

Is it possible to use the same negotiate function for .Net Core also? Or do I have to connect to signalR directly? Which library is the correct one for this:

  • Microsoft.AspNetCore.SignalR.Client
  • Microsoft.Azure.SignalR;
  • Some other?

1 Answer 1

0

I have serverless Azure Functions (NodeJs) integrated to Serverless Azure SignalR service.

Please note that setting the Service Mode setting to Serverless only if you are using Azure SignalR Service through Azure Functions binding or REST API.

For more information about Service modes of Azure SignalR Service, please check:

https://learn.microsoft.com/en-us/azure/azure-signalr/concept-service-mode

Besides, this doc shows how to broadcast real-time messages from console app, you can refer to it.

https://learn.microsoft.com/en-us/azure/azure-signalr/signalr-quickstart-rest-api

Sign up to request clarification or add additional context in comments.

1 Comment

Yes that quickstart pointed me to the correct direction. Thanks. And when I was missing dependencies such as 'System.Text.Encodings.Web' the client library ate all the exceptions. So setting log level to Trace in HubConnectionBuilder helped to see those errors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.