locked
Broadcasting message from web api to UWP app RRS feed

  • Question

  • User-1536138467 posted

    The server will be a web API <g class="gr_ gr_12 gr-alert gr_gramm gr_inline_cards gr_run_anim Style multiReplace" id="12" data-gr-id="12">in .</g>Net and client is UWP app.There are some messages stored in the database along with the expiry time and deviceId.Each message should be broadcasted to the device on the expiration of time.How can we keep a persistent connection from web API to UWP and how can we broadcast the message to a particular device.Thanks in advance for all suggestion!

    Thursday, February 1, 2018 11:58 AM

Answers

  • User283571144 posted

    Hi Kesiya Abraham,

    In my opinion, the singlar need continue running the application to connect to the server. So this is not a good choice in UWP. 

    I suggest you could consider azure notification hub.

    It could push the notification to the device with the right tag.

    More details about how to use Azure notification hub, you could refer to below article.

    https://docs.microsoft.com/en-us/azure/notification-hubs/ 

    Best Regards,

    Brando

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 2, 2018 9:30 AM

All replies

  • User475983607 posted

    ASP has the SignalR framework which uses a persistent Web Socket connection to Web API.  

    https://www.asp.net/signalr/overview/guide-to-the-api

    https://www.asp.net/signalr

    Thursday, February 1, 2018 12:17 PM
  • User-1536138467 posted

    Is it supported by UWP app?Which method is better implementing push notification or this <g class="gr_ gr_30 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="30" data-gr-id="30">SIgnalR</g> thing.Could you please suggest the best method for this requirement?

    Thursday, February 1, 2018 12:36 PM
  • User475983607 posted

    Is it supported by UWP app?

    Did you read the docs?

    Which method is better implementing push notification or this SIgnalR thing

    I have no idea how your app works or what you're requirements are.  Does your application require a persistent connection or push notifications?  

    Could you please suggest the best method for this requirement?

    You're asking the wrong audience.  Ask your users or application owners how they expect the app to work.  Next, research the technologies and come up with the best solution for the application.  

    Thursday, February 1, 2018 2:38 PM
  • User-1536138467 posted
    I am not a uwp developer.SignalR will work for other platforms like iOS devices.From the article you have shared I understood that SignalR will work for windows devices.Second this,to implement push notification we have to use azure.So if signalR will do the same thing,broadcast the messages to different devices without affect the performance of the app,it will be a good option for us.Also,if we use continous polling,it will not be a good idea.Anyway thank you for your answers.it will help me to do a R&D on this and come up with a best solution.Thanks again.
    Thursday, February 1, 2018 2:58 PM
  • User283571144 posted

    Hi Kesiya Abraham,

    In my opinion, the singlar need continue running the application to connect to the server. So this is not a good choice in UWP. 

    I suggest you could consider azure notification hub.

    It could push the notification to the device with the right tag.

    More details about how to use Azure notification hub, you could refer to below article.

    https://docs.microsoft.com/en-us/azure/notification-hubs/ 

    Best Regards,

    Brando

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 2, 2018 9:30 AM
  • User-1536138467 posted

    Hi Brando,

    Thank you for the comments.My requirement is, once an event happens on the server, the server should push a message to the specific device/user.From my understanding, SignalR will continuously check whether the event happened or not.

    Friday, February 2, 2018 10:05 AM