NAP
websocketservice.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 // Nap includes
8 #include <nap/service.h>
9 
10 namespace nap
11 {
12  // Forward Declares
13  class WebSocketInterface;
14  class WebSocketComponentInstance;
15 
23  class NAPAPI WebSocketService : public nap::Service
24  {
25  friend class WebSocketInterface;
27  RTTI_ENABLE(nap::Service)
28  public:
29  // Constructor
30  WebSocketService(ServiceConfiguration* configuration);
31 
32  // Initialization
33  bool init(nap::utility::ErrorState& errorState) override;
34 
35  protected:
40  virtual void registerObjectCreators(rtti::Factory& factory) override;
41 
48  virtual void update(double deltaTime) override;
49 
50  private:
54  void registerInterface(WebSocketInterface& wsInterface);
55 
59  void removeInterface(WebSocketInterface& wsInterface);
60 
64  void registerComponent(WebSocketComponentInstance& component);
65 
69  void removeComponent(WebSocketComponentInstance& component);
70 
71  // All the web socket servers currently registered in the system
72  std::vector<WebSocketInterface*> mInterfaces;
73 
74  // All the web socket server components currently registered in the system
75  std::vector<WebSocketComponentInstance*> mComponents;
76  };
77 }
nap::WebSocketService
Definition: websocketservice.h:23
nap::utility::ErrorState
Definition: errorstate.h:19
nap::ServiceConfiguration
Definition: service.h:28
nap::Service
Definition: templateservice.h:8
nap::rtti::Factory
Definition: factory.h:78
nap::WebSocketComponentInstance
Definition: websocketcomponent.h:41
nap
Definition: templateapp.h:17
nap::WebSocketInterface
Definition: websocketinterface.h:28