Kobi Hari
Kobi Hari

Reputation: 1258

Silverlight Architecture for event driven application

I was ask to write a silverlight client - server application. One of the architecture requirements is that the server needs to be able to send events to the client. I know that HTTP is designed in a way that the server is not supposed to "initiate" communication but rather answer requests initiated from the client. One option would be to write some sort of "polling" mechanism that keeps asking the server questions and spreads them amongst the client parts once they arrive.

My question is, is there an out-of-the-box solution for this in silverlight? Also, is there a "best practice" for this sort of things?

Thanks,

Kobi

Upvotes: 1

Views: 193

Answers (1)

Erik van Brakel
Erik van Brakel

Reputation: 23830

You could look into WCF Duplex Services, although I've got mixed experiences with that. It works like any other WCF service, with the exception that using this method both ends can send/receive messages indepedently. Basically the client keeps a long running connection open to the server, which can be used to create event-like behavior on both ends.

However, I found that due to the nature of HTTP, long running connections are not that robust, and you can get some tricky exceptions popping up which might or might not be easy to handle. It would be a good idea to prototype with this technique, to see if it will work for you.

see: http://msdn.microsoft.com/en-us/library/ms731064.aspx

Upvotes: 4

Related Questions