HttpService Class Reference

#include <Pt/JsonRpc/HttpService.h>

HTTP service for JSON-RPC 2.0. More...

Inherits Service.

Public Member Functions

 HttpService (const ServiceDeclaration &decl, Remoting::ServiceDefinition &def)
 Constructs with ServiceDeclaration and ServiceDefinition.
virtual ~HttpService ()
 Destructor.
Responder * getResponder (const Request &)
 Creates a responder to handle request received by a server.
void releaseResponder (Responder *)
 Destroys a responder created by a server.

Protected Member Functions

virtual Http::Responder * onGetResponder (const Http::Request &request)
 Creates a responder to handle request received by a server.
virtual void onReleaseResponder (Http::Responder *resp)
 Destroys a responder created by a server.
virtual void onUpgrade (Stream &stream)
 Called when a 101 reply has upgraded a connection.

Detailed Description

Makes the procedures registered in a ServiceDeclaration available as a HTTP service. Use the HttpClient to call RemoteProcedures on this service.

Member Function Documentation

◆ onUpgrade()

virtual void onUpgrade ( Stream & stream)
protectedvirtualinherited

Runs on the server thread with the Stream the server owns. The responder has already been released. Bind a StreamSession to stream to accept it. The empty implementation leaves the stream unbound, and the server closes it.

Reimplemented in WebSocketService.