Receiving chat messages with SignalR

Stesvis 1,041 Reputation points

I tested the SignalR solution in Xamarin Forms and .net core backend and it works great:

However, I am wondering how to keep receiving the messages when the app is in background mode, as this solution (in the link) only works when you have the app open on the chat page....
Do I need to implement my own push notifications? If that is the case it defeats the purpose of SignalR so I hope there is another way that I haven't found yet :)


A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,301 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
703 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Ángel Rubén Valdeolmos Carmona 586 Reputation points

    There is a solution to address this problem:

    Since signalR disconnects when the app goes to the background and some time passes. The OnResume and OnSleep events are where you have to do all the magic. When it goes to OnSleep it disconnects SignalR and when you return to OnResume you reconnect it and check the new messages.

    1 person found this answer helpful.
    0 comments No comments

  2. Mouad Cherkaoui 6 Reputation points

    Hi Stesvis-5434,

    in fact it is possible to receive messages in background mode, all you need is whether a Background Worker for UWP apps :

    or another example is Service Workers in PWA :

    it depend more on the platform you are using, for example here is an article about creating an Android service using xamarin:

    Hope it helps!

    Best Regards.