I am wondering if I need to pay for a cloud service to make push notifications work or if Microsoft provides one for free? I was asked to make an app using this windows phone feature with the assumption that it was a cost free solution.
The short answer: you need to pay for one.
You need a Web Service (WCF works nicely for this) that the user's phone can send a request to, and that service in turn makes a separate request to Microsoft.
When this is set up, there's an authentication token passed around to let your Web Service be authorized to send messages to that specific phone (via a request sent to Microsoft).
Well, the Web Service needs to be hosted somewhere (and it needs to provide an SSL (https) connection that the phone can use). That typically costs money (something like $5-$20/month depending on the host)
Related
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
I should make an application for Windows Phone 7.5, which is able to communicate bidirectionally with the same application installed on other devices with the same operating system.
I read that the Silverlight version on Windows Phone only supports BasicHttpBinding, so I think I will have to implement bi-directional mode using the BasicHttpBinding: for example, the node that accepts the incoming "connection" could send a GUID to the requesting node in order to identify a kind of session (this GUID should then be sent for each subsequent communication between two nodes).
Are there better alternatives?
The core of all communication is communication between two nodes:
there are three types of requests (one of these must be very frequently, say every 10 seconds);
the node which receives a request, could answer or ignore the request.
What is the impact on performance?
I don't think there is a way to accept connections on WP7 devices, see here.
Since WP7 doesn't support poll duplex WCF services either, I recommend you manually implement it, similar to this: http://www.dominikschmidt.net/2010/12/windows-phone-7-callbacks-and-duplex-wcf/
You will need a central server which all clients continually post messages to. Every time a Client1 calls the server, it checks the database to see if Client2 sent Client1 a message. If so, that message is included in the response to Client1.
You probably need a relay service since it's unlikely you're going to have routable, stable communication directly between devices. For example the Project Hawaii Relay Service likely will provide what you want, or you could implement something that looks and acts a whole lot like it on your own server.
We have a number of Windows services running in our system (built in C#). We use WCF to communicate with them and control them, since WCF offers very convenient communication with these processes.
Right now in our Windows GUI for managing, monitoring and troubleshooting the services, we simply register callbacks and receive notifications when a message is available from the service. Obviously this application is stateful and WCF provides the ability for the local delegate to be called when the maintained connection to the service indicates.
In our web application which users actually use, we'd like to use long-polling to have a status area on the web page (iframe, AJAX, whatever) which shows any issues which the services are reporting. We'd like to use a long-polling or other technique which minimizes actual polling on the network.
The problem we are running up against is that we need something to make the long-polling HTTP request against which will somehow always be running in IIS and which itself can be WCF-connected to our services and which can convert the event/delegate-based WCF response into a blocking-style long-poll response. It feels like a chicken-and-egg situation that some component in our system is always going to be in a loop, polling - and that's exactly what we are trying to avoid.
Does anyone have an example of doing this?
Well, if your services present with WCF, why not simply consume the WCF services with javsacript? Then you remove your IIS servers from the equation completely. if a user wants to see what the services are doing then they can retrieve the information directly from the service.
Here's a blog with someone showing how to do this:Call wcf service from Json
I am using WCF to write a server that should be able to communicate with .Net clients, Android clients and possibly other types of clients.
The main type of client is a desktop application that will be written in .Net. This client will usually be on the same intranet as the server. It will make an initial call to the server to get the current state of the system and will then receive updates from the server whenever a value changes. These updates are frequent, perhaps once a second.
The Android clients will connect over the Internet. This client is also interested in updates, but it is not as critical as for the desktop client so a (less frequent) polling scenario might be acceptable.
All clients will have to login to use the services, and when connecting over the Internet the connection should be secure.
I am familiar with WCF but I am not sure what bindings are most appropriate for the scenario and what security solution to use. Also, I have not used Android, but I would like to make it as simple as possible for the person implementing the Android client to consume my services. So, what is my strategy?
with the small bit of android I have done.
the android sdk doesn't natively support soap server, you have to write it all your self.
Rest is your only option when working with WCF and android. Thats the way that Google are pushing you to develop apps.
WCF via HTTP transport is the way to go because it is not binary and does not make assumptions re all peers are .net/windows.
see this page for more info