txjason: An interface for writing JSON-RPC 2.0 servers and clients in Twisted.


Example usage:

from twisted.internet import defer
from txjason import handler
from txjason.netstring import JSONRPCServerFactory

class Example(handler.Handler):
    # export the echo2 method as 'echo'
    def echo2(self, param):
        return param

    # exported methods may return a deferred
    def deferred_echo(self, param):
        return defer.succeed(param)

factory = JSONRPCServerFactory()
factory.addHandler(Example(), namespace='main')


Leave a Reply