HttpService Class Reference

#include <Pt/Mcp/HttpService.h>

HTTP service that serves declared MCP tools. More...

Inherits Service.

Public Member Functions

 HttpService (Remoting::ServiceDefinition &serviceDef, const ToolDeclaration &decl)
 Creates a service for serviceDef and decl.
virtual ~HttpService ()
 Destroys the service.
Responder * getResponder (const Request &)
 Creates a responder to handle request received by a server.
void releaseResponder (Responder *)
 Destroys a responder created by a server.
Signal< IOStream *, const std::string & > & upgradeRequested ()
 Returns the signal emitted when a request upgrades to this service.

Protected Member Functions

virtual Http::ResponderonGetResponder (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.

Detailed Description

HttpService is the HTTP transport the HTTP group described. It is an Pt::Http::Service: the server asks it for a responder, and that responder handles one POST as initialize, tools/list, or tools/call. Attach it to an Pt::Http::Server with Pt::Http::MapUrl or another servlet. It does not listen and it does not implement MCP on GET.

The constructor stores the Pt::Remoting::ServiceDefinition and the ToolDeclaration. Neither is owned. Both must outlive this service, and this service must outlive any responder it has not yet released. Asynchronous tool procedures run on the server's EventLoop.

Member Function Documentation

◆ upgradeRequested()

Signal< IOStream *, const std::string & > & upgradeRequested ( )
inherited

The signal provides the accepted stream and the value of the request's Upgrade header.