Always connected service

Hi,

I have a remote service I need to call every 5-10 seconds or so on a 24-hour a day basis. What do you suggest to handle the connection?

Should I always keep the connection and session active? If so how to recover in case of a lost session/connection with the server? How do I check if the connection still is valid?

Since databases are opened upon login of the server doing logins all the time does not seem a good idea.

Thanks,

Hello

This heavily depends on reliability of connection between client and server hosts.

If they both are in local network then you could use SuperHTTP or SuperTCP communication channels.
These channels maintain open connection between client and server, so no time is lost on client reconnection.

However in your case the more universal approach would be to use plain HTTP channel. This channel better handles flaky connections between hosts. It will perfectly handle 6-12 calls per minute.

Default session timeout is 30 minutes (can be adjusted). So in your case it will never expire.

If the session will be used not only for authentication purposes but will also store some important business data then you could consider to use out-of-process session storage. This can be either a custom database-based session manager (Remoting SDK has a sample of such manager) or you can use Olympia State Server as a session storage.

For a case of plain HTTP channel used the recovery question is a very simple one. At first there is no permanent connection between client and server apps.
As for the session - in case of out-of-process session storage these sessions will survive server app restart.
For in-memory sessions you will need to handle an event of the client channel that is triggered when server request authentication. This event will allow you to seamlessly re-authenticate if needed.

Regards

Ok great thanks for the input!