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() { }
36 ~qml_websocket_inbound_socket()
40 m_state->alive =
false;
45 bool isOpen() const noexcept {
return m_state !=
nullptr; }
48 const ossia::net::inbound_socket_configuration& conf,
49 boost::asio::io_context& ctx)
51 m_state = std::make_shared<state>(ctx);
55 if(onOpen.isCallable())
56 onOpen.call({qjsEngine(
this)->newQObject(
this)});
63 if(onClose.isCallable())
71 QJSValue onConnection;
73 QJSValue onTextMessage;
74 QJSValue onBinaryMessage;
77 std::shared_ptr<state> m_state;
Definition qml_device.cpp:43