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 47 forks source link

Add Multi ConnectionInfo for external negotiation routing #196

Closed Y-Sindo closed 3 years ago

Y-Sindo commented 3 years ago

Usage sample

    {
      "type": "SignalRNegotiation",
      "name": "negotiateCtx",
      "userId": "{headers.x-ms-signalr-userid}",
      "hubName": "simplechat",
      "direction": "in"
    }
module.exports = function (context, req, negotiateCtx) {
  console.log(context);
  context.res = { body: negotiateCtx.endpoints.find( e=>e.online ).connectionInfo };
  context.done();
};