I'm creating an ios application using swift for the client and C# for the server. I currently have a web app hosted in azure that communicate with the client via web api. Now I need to employ push notifications
I'm looking at Azure tutorials as my push notification provider, but it seems that it only cares about sending mass broadcasting. My need is to send custom notifications per user/device for specific notification such as "someone liked your profile" or "someone wants to connect with you" or that sort of 1-1 notifications. But look at azure example here at the section: Update server project to send push notifications (.Net) #3, there is no indication of sending a message to only one device, but rather to any device who connect to the specific hub.
So, I think the azure tutorials are not what I am looking for.
look at this lean code: He doesn't seem to be relying on any server like azure to send his notification. He is not using a hub either. He is just sending everything from a TcpClient and his notification is direct at 1 device like need it (note the deviceID he is receiving). But I've read that you must use an APNS provider all the time, so, where is his?
so, do I have to use Azure (if I want to stick to MS) to do 1-1 push notification? Does it support that? Any good tutorial about that? Or I don't need it and just simple block of C# is enough?
(I would try the code in option #2 out, but I have to setup the certificate and report back before being allocated more time)
after much investigation and trials, I found out that I don't have to rely on azure, its push notification or anything like that. I can do the entire thing by executing C# code like #2.
All I had to do is setup the .p12 certificate and give it a password. Bring it over from Mac to my pc and executed the C# code and was able to receive notifications on my phone.
Related
I am not able to send notification to my device when I specify a tag to send notification. I am able to send notification when I do not specify any tag or with simple tags like "allDevice", "girls" etc. But when I use format like "username:myname.surname#mycompany.net" it s not sending notification. I am trying both with notification hub c# library or in the azure notification hub "send test" section.
I would suggest verifying the registration stored within Notification Hubs has the expected tags present on it. So manually writing some small console application (some samples here: https://github.com/Azure/azure-notificationhubs-dotnet/tree/master/Samples/RegistrationSample) or using something like Service Bus Explorer (https://github.com/paolosalvatori/ServiceBusExplorer - supports Notification Hubs) to list registrations.
From there you should be able to enumerate your registrations and see if the tag is actually stored there. If it's not there, it indicates a problem on the application side sending the tag up.
If you're still having problems, please feel free to open a support case in the Azure Portal and someone from the team can look into your particular issue and logs on our side to determine where things are going wrong.
I have a C# console app that sends Push Notification to android device using Http post. following is my existing code:
sample code Using HTTP call to FCM
But now my requirement has been changed and not only sending the push message from server to android device, i also have to receive the acknowledge something from device to server i.e two way communication is needed.
The HTTP supports the one way communication( from server to client). I don't want to add an extra API which can be called from android device after receiving push either.
I came to know from the link https://firebase.google.com/docs/cloud-messaging/server that XMPP Protocol would do bidirectional support but i could not get a sample code how can i call the FCM using xmpp in C#.
*HTTP: Downstream only, cloud-to-device
XMPP: Upstream and downstream (device-to-cloud, cloud-to-device).
Can someone give me the sample code for sending push using XMPP in C# ?
It's not that easy just to receive the sample code since implementing XMPP is a huge amount of work. I myself implemented it by reading through RFC's and XEP's.
Since you have to authenticate and negotiate the connection with the server calling FCM from an own implementation is going to take even longer.
However, best thing you could and should do now, is looking for a Library on Github for example, that already implements the stuff you need.
Here are two of them, but I did not look into them:
https://github.com/ForNeVeR/Jabber-Net
https://github.com/tiagomtotti/firebaseNet
I hope they fulfill your needs.
I would like to implement some instant messenger-like application for Windows Phone 8.1, and I have a WCF REST service which connects to a MySQL database (I know, SQL Server would be better, but renting a server for MySQL is cheaper... :D), which stores users, etc.
I know that REST is stateless, but I would like to implement something session-like methodology to make my web service able to deliver incoming messages through the service to the recipients immediately (sending messages/request to the web service is not a problem).
So my question is, what technology / solution would you recommend for me to do this?
My basic concept is:
user registers from WP - service saves data to db
user logs in from WP - I will need some session like data, to let the server know where should it deliver messages (for example user's guid, ip address or something else, something that signals that the user is still online though the application is suspended and runs in background, and still able to receive messages)
user sends a message from WP to the rest service which should contain data about the sender (at least the user's guid, but don't wanna store too much data about user on the client side), the recipient, the content, timestamp, etc) via sending a http request for example using an uri template like this: message/send and in the request body there is the recipient's id, content, etc
user adds a contact
WCF service receives the request, processes it, sends to the recipient by identifying via it's guid and there comes the problem, should know something about the device, an ip address or session or something like that
recipient receives the message.
I hope I could describe my problem properly, and there will be anyone who can help me ^^
I would appreciate any helps!
Thanks in advance!
There’re several approaches that will work.
Use Microsoft’s push notification service (MPNS). Here’s an overview. This is the most power-efficient way, and your users will even be able to receive messages while your app’s not running.
Use Microsoft’s Windows Notification Service (WNS). It's only supported on WP 8.1, but the latency is much better (AFAIR they promise delivery time within 5 seconds).
Or, you can use some bi-directional protocol. Choose between:
WCF server + net-tcp transport: on client you'll have to implement binding + framing + SOAP yourself, the higher levels of the protocol (binary XML serialization) is in the framework.
Google protocol buffers over TCP
WebSockets: MS has the support in 8.1 SDK, third party is available for WP Silverlight
SignalR: 3rd party implementation is available
I am maintaining a queue at the server end to which users can add files. And the queue on the app which shows the files that have been added by different users has to be dynamically updated. I dont want to poll the server periodically to check if there is any new item on the queue. Is there any way to notify the client app that a new item has arrived on the queue and u have to poll the server now to retrieve that file? And I dont want a push notification, as with push notification the user will be notified, i rather want the message to be handled internally and the app should poll the server when the message is received
Please let me know if you have any ideas, i am struck on my project because of this issue.
Thanks
Push notifications are exactly for that, although your app will have to register initially (for security) - http://weblogs.asp.net/scottgu/archive/2012/12/04/ios-support-with-windows-azure-mobile-services-now-with-push-notifications.aspx
Bitsian,
You can use Windows Azure Service Bus Notification Hubs. Its just released few days ago (not even a week). It will support multiplatform push nottification (ios,android,windows 8,win phone now)
http://msdn.microsoft.com/library/jj927170.aspx
Check this link. It has some great video tutorials to start on
I found an answer to my question. Its Web Sockets!! Web Sockets can be used to maintain persistent connections between client and server. And there is a library for that - SignalR
SignalR is a new library which was introduced for ASP.Net developers to build real time web applications where server needs to continuously push data to clients.
Some links for SignalR
http://blogs.msdn.com/b/webdev/archive/2012/12/17/signalr-building-real-time-web-applications.aspx
http://www.mikesdotnetting.com/Article/206/SignalR-And-Knockout-In-ASP.NET-Web-Pages-Using-WebMatrix
We have implemented PushSharp for sending push notifications to our enterprise iOS devices. This is being sent from a Windows machine and we customized the PushSharp code to be called from a console app which is scheduled to run every minute (checks SQL Server DB for push notifications to send and then sends what is returned). This all works fine, but I have been unable to find an example of how to call the feedback service with this library. I see there is a FeedbackService.cs class that looks to handle the connections with Apple's feedback service, but the documentation doesn't cover how it works or how you use it.
Does anyone have a good tutorial or an example of how to use the feedback service?
From the source code, looks like you don't use it directly.
You can register to the Events.OnDeviceSubscriptionExpired of the PushService.
The event arguments will populate the parameter deviceInfo with the apple device id.