Pepper_56_C++_interfaces
Pepper_56_C++_interfaces
 All Classes Namespaces Files Functions Typedefs Enumerations Macros Groups
websocket.h
Go to the documentation of this file.
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef PPAPI_CPP_WEBSOCKET_H_
6 #define PPAPI_CPP_WEBSOCKET_H_
7 
8 #include <stdint.h>
9 
10 #include "ppapi/c/ppb_websocket.h"
11 #include "ppapi/cpp/resource.h"
12 
16 
17 // Windows headers will redefine SendMessage.
18 #ifdef SendMessage
19 #undef SendMessage
20 #endif
21 
22 namespace pp {
23 
24 class CompletionCallback;
25 class InstanceHandle;
26 class Var;
27 
30 class WebSocket : public Resource {
31  public:
36  explicit WebSocket(const InstanceHandle& instance);
37 
39  virtual ~WebSocket();
40 
74  int32_t Connect(const Var& url, const Var protocols[],
75  uint32_t protocol_count, const CompletionCallback& callback);
76 
105  int32_t Close(uint16_t code, const Var& reason,
106  const CompletionCallback& callback);
107 
128  int32_t ReceiveMessage(Var* message,
129  const CompletionCallback& callback);
130 
150  int32_t SendMessage(const Var& message);
151 
157  uint64_t GetBufferedAmount();
158 
163  uint16_t GetCloseCode();
164 
172 
180  bool GetCloseWasClean();
181 
190  Var GetExtensions();
191 
199  Var GetProtocol();
200 
207  PP_WebSocketReadyState GetReadyState();
208 
215  Var GetURL();
216 };
217 
218 } // namespace pp
219 
220 #endif // PPAPI_CPP_WEBSOCKET_H_
uint16_t GetCloseCode()
Var GetExtensions()
Definition: websocket.h:30
bool GetCloseWasClean()
uint64_t GetBufferedAmount()
PP_WebSocketReadyState GetReadyState()
Definition: completion_callback.h:26
Definition: instance_handle.h:44
WebSocket(const InstanceHandle &instance)
int32_t Close(uint16_t code, const Var &reason, const CompletionCallback &callback)
int32_t ReceiveMessage(Var *message, const CompletionCallback &callback)
int32_t Connect(const Var &url, const Var protocols[], uint32_t protocol_count, const CompletionCallback &callback)
A generic type used for passing data types between the module and the page.
Definition: var.h:23
Var GetCloseReason()
int32_t SendMessage(const Var &message)
A reference counted module resource.
Definition: resource.h:20
virtual ~WebSocket()
Destructs a WebSocket object.