Azure / azure-functions-signalrservice-extension

Azure Functions bindings for SignalR Service. Project moved to https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/signalr/Microsoft.Azure.WebJobs.Extensions.SignalRService .
MIT License
97 stars 46 forks source link

support diagnostic client #278

Open drdamour opened 2 years ago

drdamour commented 2 years ago

be nice if there was a way to mark my client as diagnostic, maybe just a host.json setting or possibly in the attr itself

Y-Sindo commented 2 years ago

If you are using C#, you could try the ServerlessHub.NegotiateAsync method and set the NegotiationOptions.IsDiagnosticClient to true. If you are using other languages, currently there is no way to do this. Will put this feature request into our backlog.

drdamour commented 2 years ago

@Y-Sindo i am c#, but not following recommendation. All i'm getting injected is an IAsyncCollector

Y-Sindo commented 2 years ago

Whether a client is diagnostic is decided when the client negotiates (get the client url and access token), which is irrelevant to how you send your messages, IAsyncCollector, etc. You are possible to use SignalRConnectionInfo input binding to negotiate your client and SignalRConnectionInfo has no ability to mark a client as diagnostic. But you can use another model : ServerlessHub to do the negotiation, see here for a sample. Don't forget to set the NegotiationOptions.IsDiagnosticClient to true.

Read more about negotiation: https://docs.microsoft.com/en-us/azure/azure-signalr/signalr-concept-serverless-development-config#negotiate-function

drdamour commented 2 years ago

@Y-Sindo thx I understand now