anthonychu / azure-functions-deno-worker

Run Deno 🦕 on Azure Functions ⚡️
MIT License
110 stars 17 forks source link

Handling Output Bindings #52

Open mcgear opened 1 year ago

mcgear commented 1 year ago

I tried following some related documentation elsewhere, but could not get the signalr output binding working. Can you please let me know how i should be setting outputs to get them working? Here is an example of what i am trying: https://github.com/fathym-deno/iot-ensemble-device-data/blob/integration/functions/deviceTelemetry.ts

mcgear commented 1 year ago

I went through the code, and based on lines 173-177 of mod.ts in the AzureFunctionsWorker definition, it seems like the following code should do the trick:

async function handler(context: AzureFunctionsContext) {
  context.log(`Telemetry item received: ${context.bindings.deviceTelemetry}`);
  // context.log(JSON.parse(context.bindings.deviceTelemetry));

  context.bindings!.signalRMessages = [
    {
      target: 'telemetry',
      arguments: [JSON.parse(context.bindings.deviceTelemetry)],
    },
  ];

However, non of my signalR listeners are working.

mcgear commented 11 months ago

Any thoughts on this? am i doing it right?