1

Looks tricky. Based on Stackoverflow and many other sources, this is the solution:

        connection.onclose(e => {
            fetch('http://localhost:7198/api/v1/Leaving?Id=' + Id, {
                headers: { Authorization: 'Bearer ' + token }
            });

But of course, there is no chance of this solution work. I will be closing the browser or the computer rebooted or something. I need to find a way to notify my backend when I leave a session no matter was the reason.

Aparently the solution above works good in classical mode, not in Azure Function Serverless

Any clue ?

Marco Jr
  • 6,496
  • 11
  • 47
  • 86

1 Answers1

0

you should consider to use an Azure Event Grid, see more details here.

Roman Kiss
  • 7,925
  • 1
  • 8
  • 21