Push Notification for web site - c#

I have been tasked to add push notification for a web site being developed. Never done one before. I spent a long time googling this and I am not much closer than when I started searching, mostly because most articles describe specific details.
The web application is an intranet app and they are asking for things like when a new report is made available, let the users know about it; or basically any kind of organization/department announcements.
Can someone tell me what are the components involved in developing/deploying this type push notifications? If I know what the pieces are that make this process possible, I can take it from there. I must mention that this web application is being designed to be available on devices (desktop, tablets and phones; if this makes any difference in design/development).

You can try OneSignal Push Notification
in this you can send notifications to websites,android app and ios app
You can also check the documentation for sending notifications to website here
Hope this helps:)

Related

How to setup Azure Notification Hub in C# backend

I'm trying to implement my C# backend's communication with Notification Hub. I've read almost every tutorial about Azure Notification Hub, and I can't find a decent tutorial that explains what actually corresponds to what. I think there are two ways of representing a device (from what I've understood): an Installation and Registration, and Installation seems to be newer and more preferred.
However, when I get into Installation, I get more questions in my mind:
What is InstallationId? Is it something that I create, or something that I get from somewhere, either device or PNS.
Do I need to set up ExpirationTime, or does it default to longest (it says 90 days is the longest)? What if I want it to be longer than 90 days?
What is PushChannel? Is it, just like InstallationId, something that I create, or get from somewhere?
How are templates exactly used?
Out of all these variables, which one is the actual device push token that I get at the client?
I usually don't ask those kind of questions that seek for a tutorial-ish answers and have multiple questions, but I've tried to search everywhere, but the more I search, the more it gets complicated and I don't even know where to start. Any answer would be a good starting point to anyone trying to learn Notification Hubs, just like me.
InstallationId is an abstraction on top of device token/key/channel etc. It's a unique id that you create when you 'install' a device (or user if your OS/platform allows separate tokens for multiple users). This is an id you can use to associate tags, templates etc with the device. You create an installation once and then keep the id somewhere in the local storage and then make updates to the installation associated with the id if you need to.
You don't need to explicitly set ExpirationDate. I think in the past tokens on most platforms used to expire, so this was a way to let Notification Hubs know when not to try to push to the token. I believe now it's not the case. So what happens is if Notification Hubs cannot deliver a notification to a device for a number of times, it just deletes the registration by itself.
Has this post on templates been useful?
PushChannel stands for 'The channel URI if registering the installation for WNS; Device Token if registering for APNS.'
Let me know in the comments if I can clarify any of these and I'll update the answer.
There is actually a 3rd option besides Installation and Notification: DirectSend.
The Direct-Send technique is less of an abstraction than Installation and Notification. With Direct-Send you can send notifications directly to one or more specific devices. Basically you use the actual deviceToken- as in what #NikitaG notes for PushChannel.
If you need to be able to decide specifically when your back-end application pushes to a specific-device-A-but-not-B vs. pushing to a specific-device-B-but-not-A vs. specific-device-A-and-specific-device-B according to some schedule Direct-Send can be enabling.
I'd listed some of the resources discussing Direct-Send at Azure Notification Hubs Send Notification to Specific Device.

Send and Receive Messages between Android App and Winform application

Looked for a long time and didn't find anything that showed this, so I apologize in advance I missed something.
I have an android app running on KitKat (Android 4.4.2) and a Winforms application running Windows 7. I need to send messages between the two of them.
Clearly GCM works to get the message to the Android device. I have code that sends from Winforms to the Android Device using GCM. I cannot find a way to have the Android App send anything BACK though. Is it possible to have a Winforms app RECEIVE a GCM Message? Do I have to use Azure? (All examples there seem to focus on the Windows App store and Windows 8.1 neither one of which can be a solution in this case due to client restraints.)
I'm putting this here in case anyone stumbles across it and has a similar question. This is not really an answer. Still hoping someone comes on here and shows that I am wrong. But after 26 days, no one has even offered a suggestion, so I'm guessing not.
There is no way that I have seen that allows for this the way I had hoped. Windows 7 doesn't have this built in to it (AFAIK). Windows 10 should have it built in, but Windows 7 pre-dates the huge shift to the cloud, and didn't have it in the design. If I were working with something like Xamarin -- which is a cross-platform tool, this might be possible. But there is no concept in Windows 7 for receiving messages from the Cloud.
In order to accomplish this, there would have to be some sort of server added to the mix that could take messages and pass them along via a REST API. This is beyond the scope of what I wanted to code.
The solution I found, and that works for me, is to use Microsofts API that wraps a REST service. This allows for communication to OneDrive, for example. That is what I am using as my intermediary REST server.
Microsoft LIVE SDK
This has a pretty good sample list of Android examples, and can be used for what I need. The good thing is the Upstream is just a simple call, and I don't need to have the Android device poll anything (which kills the battery). The laptop will need to poll OneDrive, but its plugged in so there is no battery life concern.
One thing to be aware of, though, is that Microsoft sort of hints that they don't want a bunch of traffic headed to OneDrive. This is from the overview doc:
Throttling
OneDrive has limits in place to make sure that individuals and apps do
not adversely affect the experience of other users. When an activity
exceeds OneDrive's limits, API requests will be rejected for a period
of time. OneDrive may also return a Retry-After header with the number
of seconds your app should wait before sending more requests.
Although, I have never seen what those limits actually are, so YMMV.

How can I create real time application and interconnected applications

I have a WCF service which exposes SOAP and REST endpoints and we have WPF,Android,Windows Phone(in future),ASP.NET applications on top of our WCF service, so many users can use many apps from different parts of the world.
Right now we have a big issues with the freshness of data we are using some old school polling techniques to look for the updated data, is there a way to create a system which push data to the connected apps regardless of the platform and location if any data update occurs on the server from any application.
I have already looked into the Duplex Callbacks but that is not possible with android and has some other limitations.i also know about the GCM for android but dont know how to make it working with other platforms apps.
GCM only works for Android devices. There are similar push notification services for Windows Phone and iOS. There are several solutions such as PushSharp and Windows Azure Mobile Services, which allow you to push notifications to several devices.
As for what to use the push notifications for. I strongly suggest not to use them to push data, as you cannot always be 100% sure if the notifications ever reach the device. Hence only use them to notify the client about new data is available, and then fetch it. Use push notifications along with polling.
It is not entirely clear what your application does, hence I do not know when and how often you need the new data. Just keep in mind that iOS for instance does not allow using a permanent background service, like Android and Windows Phone does, however the WP one does only allow for updates every 30 minutes.

Start long running process on webserver startup?

I've been away from web development for 6/7 years now and I'm completely lost in regards to how to do things. I'm going through some tutorials on HTML5 and whatnot, but I was hoping to get a helping hand here.
I'm trying to build a (POC) website which would have the "server" monitor it's running applications and when a certain application is running change the content of a hosted page. I don't want the model to be PageLoad->Application Check, I'd rather have something like ServerStart->ApplicationHook->Callback->Model->PageLoad->CheckModel, so a hook is put in place when the server starts and the callback of the hook updates a model which the page uses to update. Although this architecture may not be the best way, in general I'm just looking for a way to have a long running process which starts when the server starts up. Eventually I'l move this to a Windows service which calls a webservice when changes are made, but for a POC I'd rather keep away from multiple applications interacting, as the Windows Service would need to be "called" by the server too and I can't think of an easy implementation of that at the moment.
So, if you were building a page which relied on events on the server and needed to be able to interact with an application on the server separately to an individual page, but the page needs to be able to "post" information back to that application what would you do?
My explanation has been a bit all over the place, so I hope at some point my question has come across clearly! :)
Maybe there're alternatives but I think your only option for this kind of setup is a Windows service. If you need to talk to it from other components, have it use sockets or listen for HTTP requests on a known port. Doing what you described from a web application is not impossible but it'd be certainly very hard since it's the web server (app pool executable) that controls what happens in the process, not your code. In a Windows service, you're in control.
Edit: here's an article about the different options for hosting a web service - it seems to me that using a Windows service is, indeed, your best choice. You may be able to use a WCF service but you'll have to talk to a local application on the server and that part may be easier to do just using a Windows service.

.NET XBox Live Account API

Is there a .NET API available to get data from your XBox Live account?
All I'm really interested in is who's online, but messages would be cool too. And some sort of event driven notifications of user sign-on would be great, but I'll poll if need be.
Check out the Xbox Community Developer Program.
You can also try and take a look at https://xboxapi.com/
They provide a API system to get all sorts of info.
Example dev: https://xboxapi.com/dev/profile/Major+Nelson
their documentation is here, https://xboxapi.com/documentation
it provides info to get data in PHP json, xml, or dev.
Sadly I dont think anything like Messages and some notifications, only publicly visible info. But if you track profile info one can generate a history and if you poll the online status, you can make a popup or something

Categories

Resources