Sharing Events Between Clients

Topics: Prism v4 - Silverlight 4
Sep 23, 2011 at 8:18 AM

Good Day,

I would like to find out if it is possible to share events between different clients.
I would like to update all clients when some something of importance happens.
In my example the hotel booking system, rooms can be booked by many booking agents
as well as online clients. When a room is booked I would like to then update other users
viewmodel and inform them about the change.

My other alternative is to constantly at regular intervals poll the Database and reguest changes.
I just think if it was possible in some way to rather use the event aggregator, this would indeed save a lot
of wasted bandwidth.




Sep 23, 2011 at 2:49 PM


The guidance Prism provides is about building client side applications; therefore, components such as the Event Aggregator, whose purpose is to achieve communication between components that are loosely coupled, are intented to be used within a single "composite" application. A composite application is an application composed of different, independent modules, that are loosely coupled from each other, but can be easily and seamlessly integrated into the overall application. This implies that such components reside in the same solution.

So, it's not possible to use the event aggregator to communicate between different clients, placed on different machines, out of the box.

In order to achieve the scenario you're mentioning, you could follow an approach like the one that you mentioned (polling the database), or a similar one, but necessarily involving a server component (e.g. a web service), which is out of the scope of a Prism application.

You might find the following threads useful, where you might find some information about using web services (such as WCF services) in the context of a Prism application:

As for how to implement this notification mechanism in the server side, you might find better support in the Web Service Software Factory and the WCF forums, for example.

I hope you find this helpful.

Agustin Adami

Sep 24, 2011 at 3:26 PM

I think one of the best choices will be to use HTTP Polling.

Technically, you can write service that uses HTTP Polling and import EventAggregator into that service. When event comes in from server - publish event via EventAggregator and you in business. All other PRISM stuff will work like a charm.

Sep 25, 2011 at 4:48 PM

Hi Guys,

Thanks for the replies. That is good to know. I did solve this problem by taking one of my socket servers

out the cupboard and making some small changes to it. Put in two instances of it, one for messages and one acting

as a policy server. This work great for me.