Search code examples
.netazurewebsocketsignalr

Does an active web-sockets connection use CPU time in Azure?


With the free plan on Azure App-service, you are provided with 60 minutes of CPU time per day. I have a web app that uses SignalR for real-time communication. My question is, does 1 minute of active connection translate to 1 minute of CPU time? If that is the case I would need 60*24 minutes of CPU time per day?


Solution

  • If you are self-hosting SignalR, the protocol includes a ping at regular intervals (I think the default is 15 seconds). The server uses CPU to respond to that ping.

    You can see the request and response for keep-alive by:

    1. Going to Chrome Developer Tools network tab.
    2. Filter by just WS.
    3. Inspect the Messages tab on the SignalR hub connection.

    You'll see requests and response for {"type":6}.