views:

43

answers:

2

Hi,

Let's say I have a server running as a service, I have a client that connects to the server exchanging information.

This will work nicely on a "keep-a-live" application (a desktop application, another service etc.), but what are my option in a web environment? Create the client on each web call and connect to the server retrieving information?

Is there any other choice if it is a must for the client to be a "keep-a-live" client even on a web application?

Eg. put the client inside a service locally and somehow retrieve information from the web application to the "client in server".

Why I need the client to be a "keep alive" type of client is because it will serve as a local cache being updated form the server etc. And if I have to recreate the client on every web call the cache will not be of much use.

Anyone got any solutions?

A: 

Yes. I would create the client as a service. I'm curious: what will consume the cache maintained inside this client. I guess I'm asking what is the client of the client?

Matt Wrock
How do I answear my own question? The comment field takes to few characters.
Marcus
Found it. Right in front of my eyes :)
Marcus
A: 

Good question. If we leave out any hosting applications (desktop, web application etc.) and only look at the client server parts of what im trying to accomplish, it goes like this:

The server has a backend (database, xml, filesystem, any persistent medium), quering data and caching it. The clients (can be many) connects to the server quering objects (based on the cached data), creates object etc. If another client updates an object the server tells the other clients that object with id has been updated, heres the new values etc.

And with that in mind it gets a bit tricky when thinking of a web application. There is no problem in a desktop application because its a keep alive type of application and the thus the client will never die.

But in a web application, how can I accomplish that there?

Marcus
Hmm. Stackoverflow don't work as I expected here, why didn't my answear got placed below Matt Wrock's answear?
Marcus
I think I see now what you are trying to accomplish. This can get complicated and I would advise against trying to establish a constant connection where the server can broadcast changes to the clients. There are several implementations like this already out there. Look at memcached.
Matt Wrock
Thanks, memcached is almost the thing I thinking about.Why and on what grounds do you advise against broadcasting object changes? If I look at desktop applications you can achieve nice things with a broadcast of objects, dynamic updates of gui etc. without polling data.
Marcus