6 #ifndef ZEROEQ_HTTP_SERVER_H
7 #define ZEROEQ_HTTP_SERVER_H
9 #include <zeroeq/receiver.h>
10 #include <zeroeq/log.h>
49 ZEROEQ_API
explicit Server(
const URI& uri );
50 ZEROEQ_API
explicit Server(
Receiver& shared );
51 ZEROEQ_API
explicit Server();
52 ZEROEQ_API
explicit Server( Server& shared )
53 : Server( static_cast< Receiver& >( shared )) {}
54 ZEROEQ_API
virtual ~Server();
65 ZEROEQ_API
static std::unique_ptr< Server >
parse(
int argc,
66 const char*
const* argv);
67 ZEROEQ_API
static std::unique_ptr< Server >
parse(
int argc,
68 const char*
const* argv,
95 bool add( servus::Serializable&
object )
99 bool remove(
const servus::Serializable& object )
115 ZEROEQ_API
bool subscribe( servus::Serializable&
object );
137 ZEROEQ_API
bool subscribe(
const std::string& event,
141 ZEROEQ_API
bool unsubscribe(
const servus::Serializable&
object );
144 ZEROEQ_API
bool unsubscribe(
const std::string& event );
158 ZEROEQ_API
bool register_( servus::Serializable&
object );
173 ZEROEQ_API
bool unregister(
const servus::Serializable&
object );
176 ZEROEQ_API
bool unregister(
const std::string& event );
181 std::unique_ptr< Impl > _impl;
184 void addSockets( std::vector< detail::Socket >& entries )
final;
185 void process( detail::Socket& socket, uint32_t timeout )
final;
186 void addConnection(
const std::string& ) final { ZEROEQDONTCALL; }
Enhances servus::URI to guarantee the existance of a schema and to allow construction of [host][:port...
static std::unique_ptr< Server > parse(int argc, const char *const *argv)
Create a new Server when requested.
bool subscribe(servus::Serializable &object)
Subscribe a serializable object to receive updates from HTTP PUT requests.
bool add(servus::Serializable &object)
Subscribe and register the given object.
bool register_(servus::Serializable &object)
Subscribe a serializable object to serve HTTP GET requests.
SocketDescriptor getSocketDescriptor() const
Get the underlying socket descriptor.
std::function< bool() > PUTFunc
HTTP PUT callback w/o payload, return reply success.
const URI & getURI() const
Get the publisher URI.
std::function< std::string() > GETFunc
HTTP GET callback to return JSON reply.
bool unregister(const servus::Serializable &object)
Unsubscribe the given object for GET requests.
Serves HTTP GET and PUT requests for servus::Serializable objects.
std::function< bool(const std::string &) > PUTPayloadFunc
HTTP PUT callback w/ JSON payload, return reply success.
Base class for entities receiving data.
Publish-subscribe classes for typed events.
bool unsubscribe(const servus::Serializable &object)
Unsubscribe the given object to stop applying updates.