From a689af61eb91dcbc135890276a3c6281166d30f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 18 Aug 2024 22:15:56 +0200 Subject: Test message service for sending arbitrary data --- src/test/service.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/test/service.h (limited to 'src/test/service.h') diff --git a/src/test/service.h b/src/test/service.h new file mode 100644 index 0000000..c693ce4 --- /dev/null +++ b/src/test/service.h @@ -0,0 +1,35 @@ +#pragma once + +#include + +namespace erebos +{ + +class TestService : public Service +{ +public: + using MessageWatcher = std::function & )>; + + class Config + { + public: + Config & onMessage( MessageWatcher ); + + private: + friend class TestService; + vector< MessageWatcher > watchers; + }; + + TestService( Config &&, const Server & ); + virtual ~TestService(); + + UUID uuid() const override; + void handle( Context & ) override; + + static void send( const Peer &, const Ref & ); + +private: + const Config config; +}; + +} -- cgit v1.2.3