| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PPAPI_UTILITY_WEBSOCKET_WEBSOCKET_API_H_ | 5 #ifndef PPAPI_UTILITY_WEBSOCKET_WEBSOCKET_API_H_ |
| 6 #define PPAPI_UTILITY_WEBSOCKET_WEBSOCKET_API_H_ | 6 #define PPAPI_UTILITY_WEBSOCKET_WEBSOCKET_API_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/ppb_websocket.h" | 8 #include "ppapi/c/ppb_websocket.h" |
| 9 | 9 |
| 10 /// @file | 10 /// @file |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 /// | 40 /// |
| 41 /// @return An int32_t containing an error code from | 41 /// @return An int32_t containing an error code from |
| 42 /// <code>pp_errors.h</code>. | 42 /// <code>pp_errors.h</code>. |
| 43 /// See also <code>pp::WebSocket::Connect</code>. | 43 /// See also <code>pp::WebSocket::Connect</code>. |
| 44 int32_t Connect(const Var& url, const Var protocols[], | 44 int32_t Connect(const Var& url, const Var protocols[], |
| 45 uint32_t protocol_count); | 45 uint32_t protocol_count); |
| 46 | 46 |
| 47 /// Close() closes the specified WebSocket connection by specifying | 47 /// Close() closes the specified WebSocket connection by specifying |
| 48 /// <code>code</code> and <code>reason</code>. | 48 /// <code>code</code> and <code>reason</code>. |
| 49 /// | 49 /// |
| 50 /// @param[in] code The WebSocket close code. Ignored if it is 0. | 50 /// @param[in] code The WebSocket close code. Ignored if it is |
| 51 /// PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED. |
| 51 /// @param[in] reason A <code>Var</code> of string type which represents the | 52 /// @param[in] reason A <code>Var</code> of string type which represents the |
| 52 /// WebSocket close reason. Ignored if it is undefined type. | 53 /// WebSocket close reason. Ignored if it is undefined type. |
| 53 /// | 54 /// |
| 54 /// @return An int32_t containing an error code from | 55 /// @return An int32_t containing an error code from |
| 55 /// <code>pp_errors.h</code>. | 56 /// <code>pp_errors.h</code>. |
| 56 /// See also <code>pp::WebSocket::Close</code>. | 57 /// See also <code>pp::WebSocket::Close</code>. |
| 57 int32_t Close(uint16_t code, const Var& reason); | 58 int32_t Close(PP_WebSocketStatusCode code, const Var& reason); |
| 58 | 59 |
| 59 /// Send() sends a message to the WebSocket server. | 60 /// Send() sends a message to the WebSocket server. |
| 60 /// | 61 /// |
| 61 /// @param[in] data A message to send. The message is copied to internal | 62 /// @param[in] data A message to send. The message is copied to internal |
| 62 /// buffer. So caller can free <code>data</code> safely after returning | 63 /// buffer. So caller can free <code>data</code> safely after returning |
| 63 /// from the function. | 64 /// from the function. |
| 64 /// | 65 /// |
| 65 /// @return An int32_t containing an error code from | 66 /// @return An int32_t containing an error code from |
| 66 /// <code>pp_errors.h</code>. | 67 /// <code>pp_errors.h</code>. |
| 67 /// See also <code>pp::WebSocket::SendMessage</code>. | 68 /// See also <code>pp::WebSocket::SendMessage</code>. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 virtual void HandleWebSocketError() = 0; | 122 virtual void HandleWebSocketError() = 0; |
| 122 | 123 |
| 123 private: | 124 private: |
| 124 class Implement; | 125 class Implement; |
| 125 Implement* impl_; | 126 Implement* impl_; |
| 126 }; | 127 }; |
| 127 | 128 |
| 128 } // namespace pp | 129 } // namespace pp |
| 129 | 130 |
| 130 #endif // PPAPI_UTILITY_WEBSOCKET_WEBSOCKET_API_H_ | 131 #endif // PPAPI_UTILITY_WEBSOCKET_WEBSOCKET_API_H_ |
| OLD | NEW |