Hi devs!

I'm evaluating thrift for bidirectional RPC communcation between client and
server. I basically have two ideas:

1\ follows the blog post
http://joelpm.com/2009/04/03/thrift-bidirectional-async-rpc.html which
basically makes the RPC fully asynchronous.

Even though it feels really hacky (having to implement everything asynch is
a pain) it further seems to be impossible to implement with the csharp
library implementation currently in trunk. At last the TProcessorFactory is
not available in csharp and even though one could ship around that problem
by providing a TProtocolFactory implementation I've got the feeling that the
API of all Thrift libs should be as consistent as possible throughout the
different implementations.

2\ would be to use two sockets, one for synchronous rpc calls and the second
for server-triggered event calls

Has anyone ever thought of adding support server to client communication?
I.e. a .thrift file could look like:

  service Echo {
    bool Echo(),
    callback Event(1: bool arg1, 2: i32 arg2)
  }

And (speaking for the csharp world) one could implement it on client-side
like this:

  public interface Iface {
    bool Echo();
    void SubscribeEvent();
    void UnsubscribeEvent();
    event Action<bool, int> Event;
  }

where the "callback" keyword marks a server-to-client RPC invoke. And
finally the server-side interface definition could look like:

  public interface IfaceService {
    bool Echo();
    void SubscribeEvent();
    void UnsubscribeEvent();
    void Event(bool arg1, int arg2);
  }

where a server-call to Event(bool arg1, int arg2) invokes the event on every
client that invoked "SubscribeEvent".

I like the Thrift cross platform idea and can imagine a great future if
there was native bidi support. For now Thrift can work for our purpose by
implementing a client-side service and a server-side service, but everyone
knows the implications to firewall policies etc.

So, let me know what you guys think of this idea. Thrift would be the first
open source library supporting bidi communication and effectively become the
first framework to implement WebSockets! :-)

Cheers,
Dominik

Reply via email to