Squeazer
Squeazer

Reputation: 1254

What is the right way to communicate between a C# server and Windows Phone?

Ok so i have a C# server and a windows phone app that acts as a client. The client will have to modify settings on the server, receive images from the server (possibly a video stream) and receive notifications from the server (the best way would be instantaneous, like when someone sends you a message on facebook and you get the notification right away).

I have the server and client set up so they are communicating, they are sending each other an object that is serialized with XmlSerializer (it currently only contains a public String field with public get/set methods). They connect over a socket. This works well if i want to send just simple messages between them, but i assume i'll run into problems when i want to have instant notifications and transfer of images / video streams. How would i go about continuing my work in a proper way?

Upvotes: 0

Views: 480

Answers (2)

Dan Badea
Dan Badea

Reputation: 136

I think if you are looking for two way communication between the client and server then using sockets is the way to go.

As for images you don't need to send the actual image. You can just pass a URL to it and then download it with one of the classes specialized for that.

For near instant notifications you could also take a look at push notifications.

Of course if you don't really need the server to push data to the client then it would be much simpler if you used a REST API as someone else suggested.

Upvotes: 1

Arin Ghazarian
Arin Ghazarian

Reputation: 5305

Consider designing an API solution via web services using RESTful or SOAP services. Personally I suggest using RESTful web services. Here are some kick start links about REST:

  1. http://www.codeproject.com/Articles/255684/Create-and-Consume-RESTFul-Service-in-NET-Framewor
  2. http://www.codeproject.com/Articles/148762/NET-4-0-RESTful-Web-Service-Introduction
  3. http://www.codeproject.com/Articles/21174/Everything-About-REST-Web-Services-What-and-How-Pa
  4. http://msdn.microsoft.com/en-us/library/dd203052.aspx

This is another useful article in MSDN which compares WCF REST and WCF SOAP: http://msdn.microsoft.com/en-us/library/vstudio/hh273094(v=vs.100).aspx

Upvotes: 1

Related Questions