39 friend class query_answerer;
44 using connection_handler = std::weak_ptr<void>;
53 bool push_bundle(
const std::vector<const ossia::net::parameter_base*>&)
override;
54 bool push_raw_bundle(
const std::vector<ossia::net::full_parameter_data>&)
override;
55 bool echo_incoming_message(
66 int get_osc_port()
const {
return m_oscPort; }
68 int get_ws_port()
const {
return m_wsPort; }
71 void for_each_client(F&& f)
const
72 noexcept(
noexcept(f(std::declval<const oscquery_client&>())))
74 ossia::lock_t lck{m_clientsMutex};
75 for(
auto& clt : m_clients)
81 Nano::Signal<void(
const std::string&)> onClientConnected;
82 Nano::Signal<void(
const std::string&)> onClientDisconnected;
84 void disable_zeroconf();
85 void set_zeroconf_servers(
86 net::zeroconf_server oscquery_server, net::zeroconf_server osc_server);
90 oscquery_client* find_client(
const connection_handler& hdl);
92 void add_node(std::string_view path,
const string_map<std::string>& parameters);
93 void remove_node(std::string_view path,
const std::string& node);
94 void rename_node(std::string_view node,
const std::string& new_name);
97 void on_OSCMessage(
const oscpack::ReceivedMessage& m, oscpack::IpEndpointName ip);
100 void on_connectionOpen(
const connection_handler& hdl);
101 void on_connectionClosed(
const connection_handler& hdl);
110 template <
typename T>
113 void update_zeroconf();
116 ossia::net::server_reply
117 on_WSrequest(
const connection_handler& hdl,
const std::string&
message);
118 ossia::net::server_reply
119 on_BinaryWSrequest(
const connection_handler& hdl,
const std::string&
message);
121 std::unique_ptr<osc::receiver> m_oscServer;
122 std::unique_ptr<ossia::net::websocket_server> m_websocketServer;
124 net::zeroconf_server m_zeroconfServerWS;
125 net::zeroconf_server m_zeroconfServerOSC;
128 net::listened_parameters m_listening;
131 clients m_clients TS_GUARDED_BY(m_clientsMutex);
136 std::thread m_serverThread;
139 mutable mutex_t m_clientsMutex;
142 uint16_t m_oscPort{};
146 bool m_disableZeroconf{};
153 ossia::spsc_queue<std::function<void()>> m_functionQueue;