How to implment a GCM Server in C# that supports CCS - c#

I'm trying to write a 3rd party server application for sending and receiving notifications from Android devices using GCM's CCS as outlined here. I'm leveraging PushSharp for handling the sending of notifications from my server app, but I can't seem to find any documentation on how to receive messages at the server level. Is this supported or is there another 3rd party XMPP library for .NET that handles this cleanly?

I dont think you can receive messages at server level, this is not the point in push notifications. if you want to send information to the service from the app, i would suggest writing a webservice. i've implemented this myself, and had to do a little digging to find some code that could communicate with the webservice as it was written in c# and the app was java, but i can paste some code that might help if you think that would help you communicate.
Long story short though, if you want an app to talk to a server, then write a web service. if you want a server to talk to an app, use push notifications.

Related

Notify windows program from WebServer

At the moment I'm writing a small program in C# for windows 7 which can send notifications over GCM (Google Cloud Messeging) to my Android smartphone. For this I send some data via POST to my WebServer which then pushes the data over GCM to my smartphone. That works great in this way but I also want to send some data to my program from my Smartphone.
My problem now is that I do not know how I can notificy my C# program from my WebServer. I thought about something like this:
Smartphone -> send Data to WebServer -> notify C# program
I do not want to use polling and the GCM client is only for android smartphones. So what do you think is the best way to notify my program that some data is avaible for it? I read something about HTTP streaming but I do not know how it works and have no idea if I can implement it with C#. Or do you have other ideas how I can solve this problem?
SignalR is a good shout but you should also understand the base concepts of socket programming. C# makes it really easy to open a socket and listen for messages. The Microsoft website shows you how to handle a requests synchronously here.
Http is just a message protocol. Once you understand the protocol reading the messages is not too hard. Remember if you are receiving messages from the server it will need to know your IP address etc.

Live Messenger app Windows Phone 8

I want to create an Instant Messaging app for Windows Phone.
I have found some information about Live SDK, but it looks like the messenger api is outdated?
Can anyone help me start? All I want to do at first is embed the IM.
A simple IM app where the user logs in with their Live ID, sees who already has the app (Live Contacts) and an IM-service with a UI like the SMS-service in windows phone.
Can anyone help me get started?
Firstly i hope i got your question right.
I have multiple lookouts for you:
XMPP (Jabber): start from there. It is fairly simple, and there are opensource clients out there where you can dismantle code and learn by understanding what others have done.
Check out the SignalR
ASP.NET SignalR is a new library for ASP.NET developers that makes it incredibly simple to add real-time web functionality to your applications. It's the ability to have your server-side code push content to the connected clients as it happens, in real-time.
You may have heard of WebSockets, a new HTML5 API that enables bi-directional communication between the browser and server. SignalR will use WebSockets under the covers when it's available, and gracefully fallback to other techniques and technologies when it isn't, while your application code stays the same.
SignalR also provides a very simple, high-level API for doing server to client RPC (call JavaScript functions in your clients' browsers from server-side .NET code) in your ASP.NET application, as well as adding useful hooks for connection management, e.g. connect/disconnect events, grouping connections, authorization.

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?
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:
http://www.codeproject.com/Articles/255684/Create-and-Consume-RESTFul-Service-in-NET-Framewor
http://www.codeproject.com/Articles/148762/NET-4-0-RESTful-Web-Service-Introduction
http://www.codeproject.com/Articles/21174/Everything-About-REST-Web-Services-What-and-How-Pa
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
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.

Android connecting to a .NET application and sending text

I have a C# .NET application listening on a specific port for data (SocketServer).
Using Android, I would like to connect to that SocketServer and send text data to it. I do not know where to get started - sample code would be great.
Take a look at TCP .NET/C# Server with Java client?.
Other than that, you could always recode your server into a REST service, and then anything can communicate with it. But I know this isn't a good answer as I'm sure you don't want to recode the server.

How to create an IM bot with C#

Is there an easy way to create an IM bot on multiple im networks (aim, gtalk, yim, etc) that can accept and interpet specific commands sent to it to perform a server related task?
Lets say for instance I have a website for managing an rss feed. I want to send a command to an IM bot to add another feed to my collection. the IM bot would associate my screen name with my account from prior setup on the website.
I have done some internal bots for my company using the XMPP (Jabber) protocol, I've used the agsXMPP SDK and the Jabber.NET client libraries, I was looking for APIS to work with YIM, AIM and Windows Live Messenger but I've found only COM exposed APIS, nothing for .NET...
But an idea comes to my mind, with the XMPP Protocol you can configure a local server with IM Gateways, that allow users to access networks using other protocols through your server
I use eJabberd, you can install a variety of transport gateways to connect with other IM protocols (AIM, MSN, ICQ, GTalk...
To GTalk you can connect directly using the libraries I mention...
A sample ICQ gateway:
The short answer to this question is yes this can be done relitivly easily. Sedning and receiving IMs sending, receiving and interpreting requests from the network you wish to communicate on and there are libraries available for each of the major IM protocols to make this easier.
For messenger you can try the DotMsn library, I have used it in the past but at that time it was still quite new and I have not used it since so I can't vouch for it's quality.
Jabber uses the XMMP protocol which is an open-standard so there are bound to be plenty of client libraries available.
If I recall correctly Google Talk uses this protocol or a modified version thereof.
I dont have experience with c# but I have written one for AIM and Gtalk using PHP. http://www.imified.com/ is the best place to start if you looking for a easier way to write an IM bot.
Basically you create an account in imified.com .
Name your bot and link a script.
When ever a message is sent to the bot, imified.com automatically runs this script.
Here is a link for you get you started!
We have professional .NET/COM/VCL library for MSN/Yahoo/ICQ/AIM/GTalk/Jabber. Please take a look at http://www.imcomponents.com/ if you like.

Categories