Lovense Integration: LovenseIntegration/Source/LovenseIntegration/Classes/LovenseToyEventsWebSocketHandler.h Source File

Lovense Integration

LovenseToyEventsWebSocketHandler.h
1 // Fill out your copyright notice in the Description page of Project Settings.
2
3 #pragma once
4
5 #include <CoreMinimal.h>
6
7 // EXTERNAL INCLUDES
8 #include <Runtime/Launch/Resources/Version.h>
9 #if ENGINE_MAJOR_VERSION > 5 || ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 2
10 #include <Engine/TimerHandle.h>
11 #else
12 #include <Engine/EngineTypes.h>
13 #endif
14
15 // INTERNAL INCLUDES
16
17
18 class LovenseToyEventsWebSocketHandler : public TSharedFromThis<LovenseToyEventsWebSocketHandler> {
19 public:
20 LovenseToyEventsWebSocketHandler();
21
22 bool Initialize();
23 void Shutdown();
24
25 private:
26 void OnConnected();
27 void OnConnectionError(const FString& error);
28 void OnConnectionClosed(int32 statusCode, const FString& reason, bool bWasClean);
29 void OnMessage(const FString& message);
30 void OnRawMessage(const void* data, SIZE_T size, SIZE_T bytesRemaining);
31 void OnMessageSent(const FString& messageString);
32
33 void Ping();
34
35 private:
36 TSharedPtr<class IWebSocket> webSocket;
37 FTimerHandle pingTimerHandle;
38 double pingTimestamp;
39 };
LovenseToyEventsWebSocketHandler
Definition: LovenseToyEventsWebSocketHandler.h:18