2#include <ossia/network/context.hpp>
3#include <ossia/network/sockets/udp_socket.hpp>
5#include <ossia-qt/protocols/utils.hpp>
11#include <nano_observer.hpp>
17class qml_websocket_inbound_socket
19 ,
public Nano::Observer
21 W_OBJECT(qml_websocket_inbound_socket)
25 boost::asio::io_context& context;
26 std::atomic_bool alive{
true};
28 state(boost::asio::io_context& ctx)
34 qml_websocket_inbound_socket(
35 const ossia::net::inbound_socket_configuration& conf, boost::asio::io_context& ctx)
36 : m_state{std::make_shared<state>(ctx)}
42 ~qml_websocket_inbound_socket() { m_state->alive =
false; }
44 inline boost::asio::io_context& context() noexcept {
return m_state->context; }
48 if(onOpen.isCallable())
50 onOpen.call({qjsEngine(
this)->newQObject(
this)});
57 ossia::qt::run_async(
this, [=,
this] { onClose.call(); }, Qt::AutoConnection);
64 QJSValue onConnection;
66 QJSValue onTextMessage;
67 QJSValue onBinaryMessage;
70 std::shared_ptr<state> m_state;
Definition qml_device.cpp:43