Method Implementation.
class ExampleHandler : virtual public ExampleIf { void printString (const std::string &text) override { // Method implementation goes here ... } ... }
Server Initialization.
// Handler is the user defined implementation. std::shared_ptr<ExampleHandler> handler (new ExampleHandler ()); // Processor is responsible for decoding function arguments and invoking the handler. std::shared_ptr<ExampleProcessor> processor (new ExampleProcessor (handler)); // Transport provides reading and writing of byte buffers. std::shared_ptr<TServerTransport> transport (new TServerSocket (SERVER_PORT)); // Buffered transport is a wrapper for another transport object. std::shared_ptr<TTransportFactory> transport_factory (new TBufferedTransportFactory ()); // Protocol provides reading and writing of individual types on top of transport. std::shared_ptr<TProtocolFactory> protocol_factory (new TBinaryProtocolFactory ()); // New connections use their own transport and protocol instances hence the factories. std::shared_ptr<TServer> server (new TSimpleServer (processor, transport, transport_factory, protocol_factory)); server->serve ();
Public read
and write
methods on generated transport types
Multiple transports available
Plain socket
Socket with SSL
Socket with HTTP
Socket with WebSocket
Wrapper for zlib compression
File and pipe
Memory buffer
Multiple protocols available
JSON
Simple binary encoding
Compact binary encoding
Wrapper for serving multiple services
Multiple servers available
Single main thread
Thread per connection
Thread pool with fixed size
Thread pool with fixed size and dedicated dispatcher