Twitch SDK (Internal)
standardwebsocket.h
Go to the documentation of this file.
1 /********************************************************************************************
2 * Twitch Broadcasting SDK
3 *
4 * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5 * may not be copied or used except in accordance with the terms of that agreement
6 * Copyright (c) 2012-2016 Twitch Interactive, Inc.
7 *********************************************************************************************/
8 
9 #pragma once
10 
11 #include "twitchsdk/core/socket.h"
13 
14 namespace ttv
15 {
16  class StandardWebSocket;
17  class StandardWebSocketFactory;
18  struct StandardWebSocketInnerData;
19 }
20 
21 
23 {
24 public:
26  virtual ~StandardWebSocket();
27 
28  TTV_ErrorCode Initialize(const std::string& uri);
29 
30  // IWebSocket Implementation
31  virtual TTV_ErrorCode Connect() override;
32  virtual TTV_ErrorCode Disconnect() override;
33  virtual bool Connected() override;
34  virtual TTV_ErrorCode Send(MessageType type, const uint8_t* buffer, size_t length) override;
35  virtual TTV_ErrorCode Recv(MessageType& type, uint8_t* buffer, size_t length, size_t& received) override;
36  virtual TTV_ErrorCode Peek(MessageType& type, size_t& length) override;
37 
38 private:
39  struct SocketData;
40 
42 
43  std::unique_ptr<SocketData> mInnerData;
44 };
45 
46 
48 {
49 public:
50  virtual ~StandardWebSocketFactory();
51  virtual bool IsProtocolSupported(const std::string& protocol);
52  virtual TTV_ErrorCode CreateWebSocket(const std::string& uri, std::shared_ptr<IWebSocket>& result);
53 };
TTV_ErrorCode PollBaseSocket()
Definition: socket.h:442
virtual bool Connected() override
std::unique_ptr< SocketData > mInnerData
Definition: standardwebsocket.h:43
virtual TTV_ErrorCode Send(MessageType type, const uint8_t *buffer, size_t length) override
Definition: socket.h:290
TTV_ErrorCode CreateWebSocket(const std::string &uri, std::shared_ptr< IWebSocket > &result)
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
virtual TTV_ErrorCode Recv(MessageType &type, uint8_t *buffer, size_t length, size_t &received) override
virtual TTV_ErrorCode Peek(MessageType &type, size_t &length) override
Definition: standardwebsocket.h:22
virtual ~StandardWebSocket()
uint32_t TTV_ErrorCode
Definition: errortypes.h:30
virtual TTV_ErrorCode Disconnect() override
TTV_ErrorCode Initialize(const std::string &uri)
virtual TTV_ErrorCode Connect() override
MessageType
Definition: socket.h:296
Definition: standardwebsocket.h:47