NAP
iwebsocketclientendpoint.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 // Local Includes
8 #include "websocketutils.h"
9 #include "websocketconnection.h"
10 
11 // External Includes
12 #include <nap/device.h>
13 
14 namespace nap
15 {
16  // Forward Declares
17  class IWebSocketClient;
18 
34  class NAPAPI IWebSocketClientEndPoint : public Device
35  {
36  friend class IWebSocketClient;
37  RTTI_ENABLE(Device)
38  public:
39 
48  virtual bool send(const WebSocketConnection& connection, const std::string& message, EWebSocketOPCode code, nap::utility::ErrorState& error) = 0;
49 
59  virtual bool send(const WebSocketConnection& connection, void const* payload, int length, EWebSocketOPCode code, nap::utility::ErrorState& error) = 0;
60 
61  bool mLogConnectionUpdates = true;
63 
64  protected:
72  virtual bool registerClient(IWebSocketClient& client, utility::ErrorState& error) = 0;
73 
80  virtual void unregisterClient(const IWebSocketClient& client) = 0;
81  };
82 }
nap::WebSocketConnection
Definition: websocketconnection.h:27
nap::utility::ErrorState
Definition: errorstate.h:19
nap::EWebSocketLogLevel::Warning
@ Warning
Information about important problems not severe enough to close connection.
nap::IWebSocketClient
Definition: websocketclient.h:34
nap
Definition: templateapp.h:17
nap::IWebSocketClientEndPoint
Definition: iwebsocketclientendpoint.h:34
nap::EWebSocketOPCode
EWebSocketOPCode
Definition: websocketutils.h:29
nap::EWebSocketLogLevel
EWebSocketLogLevel
Definition: websocketutils.h:17
nap::Device
Definition: device.h:20