Using Jabber to send network messages - windows

(Also asked over on ServerFault, where I was advised to post it here too)
We have a requirement to send desktop alerts to various users (compliance, production) across a network when other users have submitted content online for a report.
At present we are using NET SEND but this has no guarantee of delivery and has proved unreliable from both client and server perspective (and I gather will be unsupported in later versions of Windows; we are currently running XP).
We are considering a Jabber-based solution but has anyone used a Jabber client to pop up alert messages on the screen like NET SEND does, as opposed to just bringing a chat window to the front or displaying a temporary 'toast' message near the system tray.
We need the alert message to be persistent and only dismissed by the user, indicating they have seen it. Toast-style pop-ups would be fine as long as it was not only for a limited time and again had to be dismissed by the user.
Any solutions?

Openfire is a java based Jabber server that seems to be targeted to a corporate/business environment and provides the "toast" message feature with their Spark client. They also offer several other useful business-focused features.

Offline message delivery is not guaranteed by XMPP specification. It depends on concrete server implementation. Moreover, it has cost in supporting user accounts.
As an out-of-box solution it is fine, but since we are in development community, I would
consider building alert system using MessageQueue for guaranteed delivery.

The message-delivery semantics of XMPP are liable to be a good fit for your application, since you're not talking about financial transactions that require fiduciary-level delivery guarantees. It will certainly be better than NET SEND by a lot.
Write a simple client that listens for messages and does the pop-ups in whatever format you want, and have the program run in the background, perhaps with a tray icon. Writing something like that with Jabber-Net would be the work of a few hours, for example.

Related

How to build real time notifications in a distributed project?

I wonder to know which technique and tools I should use to have the ability to send real time notifications to users. Specifically if I build a messaging system.
I can see that modern social networks can send notifications about new messages almost immediately. Even when the user 'A' from one country writes a message to the user 'B' in another country you can see that the user 'A' writes a message and you immediately see it (even if those users live in different continents).
I tried to figure out how it is possible and find any information about this but without success.
The only thing I found out is the technique when we use a Redis or RabbitMQ server with several servers which acts like publishers and subscribers. Our API servers receive new messages then they push a new message in the queue then subscribers receives the messages and if they have an open WebSocket with the recipient they push this message in the WebSocket and a client receives the message.
But it really won't work if you have a distributed project and your clients are connected to the nearest servers in the nearest data center.
The question is: what technologies/techniques/anything we should use to be able to build notifications in a distributed project?
If you develop your distributed app/system using web technologies, you can consider building what is referred to as a Progressive Web App. With PWAs you can add push notifications in a relatively easy way. You could start with a PWA approach, and then decide later on if developing a native app as well (i.e. iOS or Android) would be necessary.
There are many resources to learn and guide you in developing progressive web apps. Check the references I mentioned above, and you can do this codelab as a starting point.

Server/Client legals

So I want to create some sort of anonymous chat application. The model includes a single server (centralized) and multiple clients.
The server takes no records of the chat and also no records of who has connected amd such to maximise privacy the messages are also encrypted. You get the idea.
Now, my question was: say someone sent a link to a warez site or something deemed somewhat questionable or outright illegal. Who would get into trouble? The server owner or the client? Take into account that the server only provides a means to communicate between clients and holds no information other than the brief time it needs to receive and send.
Same thing with bots connecting to the server and using it for a communication portal for a botnet.
Thanks in advance.

Remote Control for Website

I want to start to create a website which is opened on a mobile phone (any kind of smartphone). This website will have the feature to control a website you have already opened on your computer. (The Volkswagen New Century Beetle from 2011 had the feature, that i could scroll via smartphone on the website opened on my desktop computer)
We have a streaming website for horsevideos, and this will be an awesome feature for our customers, if they could watch the streams on their smart tv and control via iphone/android/wp.
Also wilmaa.com from switzerland provides a remote control for smartphone to navigate on my website on smart tv/webbrowser.
Because I need a starting point to learn how it works i was checking Google, maybe there already any remote controls outside, but unfortunately i couldn't find anything.
Maybe Stack Overflow can help me by giving some starting points on how to realize this.
To do this you need some kind of 'pushing' service able to overcome the inherent drawback of HTTP that it has always been a 'pull only' system - client initiates a request, server answers. In this case you want to push an event from the server to the client.
For the past years this has been done with so called 'long polling'. This means that you 'abuse' the mechanism present in browsers that protects the server from hanging requests, but allows them to take a while. Apache is by default configured to allow a request to last 300 seconds on most platforms. Long polling works by sending an Ajax request, and if the server has no data, instead of sending that back it just waits, until either it does have data, or a long period such as a minute has expired. The client does not send a new request until it has received a response. This gives the illusion to the end user of real time feedback, and is how sites like Facebook et al have done this for years.
Since a few months it's also possible to employ a new HTML5 technology that now has stable implementations on all major browsers: Websockets. This technology allows a server to upgrade a common pull request to a full bidirectional connection, allowing realtime communication between browser and server. Regrettably, the 'regular' webservers such as Apache are not really built for this kind of logic, although it is possible to emulate it with frameworks like Ratchet. For the realtime part of the system the current platform of choice for most sites, including Stack Overflow here, is node.js - serverside asynchronous Javascript.
What I would recommend in your situation:
Set up a separate node.js server as an event dispatcher (you can get a cheap micro sized EC2 instance at Amazon for like $15 per month which will probably suffice, and is very scalable)
Keep all the other code in the regular environment where it is now, just add logic to communicate with the event dispatcher
Deploy Socket.io as your websocket handling service. It simplifies all the Javascript logic on both server and client side, and wraps a realtime connection in such a way that it's even compatible with IE5.5, by gracefully degrading towards technologies that are supported by both server and client - websockets on recent browsers, long polls or other technologies on legacy systems.
With this solution you can easily implement, with relatively little code, a system with full realtime responsiveness across multiple platforms as you described.
As for the controlling app itself, just use HTML5, with Phonegap if you intend to distribute to app stores.

WP7 send toast from one device to another

Just wondered if it was possible to send a toast from one WP7 phone to another.
Example of use:
User A presses a button on their phone to alert other users driving nearby with status "empty" that they are needed at the GPS location of User A
If anyone can provide some insight on if this is possible, and how it can be done, it would be great.
Thanks,
Can you?
No.
If I understand your question correctly, no it is not possible.
I understand your question to be "can I do this without having to implement something on a server somewhere?" And the answer to that is unfortunately "no".
What you will need to do as #softarn and #MrMDavidson alude to, you will need to implement something on the server.
But why not?
The reason for this is pretty simple. IF it was possible to do this, then it would open the door for abuse. Imagine if, without having to go through a Microsoft server, I could write a bit of code that would send push notifications constantly to all my users (who had downloaded my app of course). What happens if my users are on data plans that charge per bit? Well I've just screwed over a whole bunch of my users, and not only are they upset with me, they're upset with their stupid phone. Alternatively, what if Microsoft wants to give all windows phone users the option to get push notifications only every 15 minutes instead of immediately? Well, without operating as a go-between, Microsoft would be entirely unable to provide such functionality.
Here's how to fake it
So, in order to interact with toast notifications, it's a requirement that Microsoft gets to play middle man, so if needed, they can pull the plug on / monitor / regulate toast notifications on behalf of the user.
If you wanted to implement a bit of server code that emulated this behavior, that is certainly possible. As #MrMDavidson says, you'd basically need to take the following steps in the architecture of your app:
User's GPS location changes
WP7 app contacts a server that you own, notifying it that the user has moved
Your server code makes note of this, storing the data in a SQL database
After storing your new location, the server scans the SQL database for all other users of your app who are "nearby" and have their status set as "empty"
For each of the users in the database that match the criteria of being (a) nearby, and (b) having an empty status, the server code calls the user's "channel uri", sending the desired message
To your users, it's all the same
This would effectively accomplish your goal, and from the perspective of users, the experience would be seemless, and for all intents and purposes it will appear as if they got a notification directly from another user's phone.
Hope that clarifies things, I did assume you're familiar with the general workflow of sending Toast Notifications.
Happy coding!
Provided that User A's phone knows the push notification URI for User B's phone then, yes, you can send notifications from one phone to the other. However the question becomes; How do you distribute User B's notification URI to User A's phone? You'll either need an "offline" mechanism (email, for instance) or a server to act as a central repository. You're probably better off having a service layer over the top of the push notifications though to manage user-to-user relationships. Then User A's phone can say "Tell my friends that they're needed!". This can be an async-fire-and-forget call to your server. Your server can then implement retries and parallel execution to notify all User A's friends that they're needed at the location.
Yes of course it is possible. Read on to how push notifications work, though I don't think it will be as easy as you think. You'll need (I think) a server that the phones communicate through.

broadcasting data to mobile devices

I working on a project were mobile users can receive alerts based on diferent factors, the server side will be implemented using the MVC framework.
My question is regarding the client side; what would be the most efficient way to send the alerts to the clients? is there any way to broadcast the alerts to each device or do I have to set up some system where each device pulls the data from the server on an interval of mins/seconds? I am afraid pulling the data every X secs/mins would create an unnesesary overhead on the mobile devices.
One way would be using SMS but SMS gateway services are expensive and not on my budget right now.
I haven't personally tried it, but this service might work for you:
http://www.airgramapp.com/api
It is free for limited use. Downside is it appears to be a separate install on the mobile device. This might means less control of the content of the message or its look. Upside is it looks quick and easy if you just need a proof of concept at this point.

Resources