Push Notification mechanism between a server and a client app

后端 未结 4 1391
一生所求
一生所求 2020-12-29 10:30

I am developping a desktop application using C#, which communicates with a server over a WCF Web Service. It is supposed to be a kind of synchronization application. Meaning

相关标签:
4条回答
  • 2020-12-29 11:08

    PushSharp :A server-side library for sending Push Notifications to clients (the clients are basically mobile devices - but can be custom as well)! You google to get some tutorial on PushSharp use as well.

    0 讨论(0)
  • 2020-12-29 11:12

    tolga, you can use winforms with signalR, server side can be asp.net or a standalone windows application..

    0 讨论(0)
  • 2020-12-29 11:12
            var webAddr = "https://fcm.googleapis.com/fcm/send";
    
            var httpWebRequest = (HttpWebRequest)WebRequest.Create(webAddr);
            httpWebRequest.ContentType = "application/json";
            httpWebRequest.Headers.Add("Authorization:key=YOUR_SERVER_KEY");
            httpWebRequest.Method = "POST";
    
            using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                string json = "{\"to\": \"/topics/news\",\"notification\": {\"body\": \"New news added in application!\",\"title\":\"" + Your_Notif_Title+ "\",}}";
                streamWriter.Write(json);
                streamWriter.Flush();
            }
    
            var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                result = streamReader.ReadToEnd();
            }
    
    0 讨论(0)
  • 2020-12-29 11:17

    You need to implement a publish and subscribe design. In WCF you could use net-tcp protocol to connect in duplex clients and server.

    You could download a quite good implementation on http://www.idesign.net/Downloads/GetDownload/2032

    And you will find a good article here.

    Regards

    0 讨论(0)
提交回复
热议问题