| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CPP_DEV_WEBSOCKET_DEV_H_ | 5 #ifndef PPAPI_CPP_DEV_WEBSOCKET_DEV_H_ |
| 6 #define PPAPI_CPP_DEV_WEBSOCKET_DEV_H_ | 6 #define PPAPI_CPP_DEV_WEBSOCKET_DEV_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/dev/ppb_websocket_dev.h" | 8 #include "ppapi/c/dev/ppb_websocket_dev.h" |
| 9 | 9 |
| 10 /// @file | 10 /// @file |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 /// GetProtocol() returns the sub-protocol chosen by the server for the | 98 /// GetProtocol() returns the sub-protocol chosen by the server for the |
| 99 /// specified WebSocket connection. | 99 /// specified WebSocket connection. |
| 100 /// | 100 /// |
| 101 /// @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before | 101 /// @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before |
| 102 /// the connection is established, its data is empty string. | 102 /// the connection is established, its data is empty string. |
| 103 Var GetProtocol(); | 103 Var GetProtocol(); |
| 104 | 104 |
| 105 /// GetReadyState() returns the ready state of the specified WebSocket | 105 /// GetReadyState() returns the ready state of the specified WebSocket |
| 106 /// connection. | 106 /// connection. |
| 107 /// | 107 /// |
| 108 /// @return Returns <code>PP_WEBSOCKETREADYSTATE_CONNECTING</code> if called | 108 /// @return Returns <code>PP_WEBSOCKETREADYSTATE_INVALID_DEV</code> if called |
| 109 /// before the connection is established. | 109 /// before connect() is called. |
| 110 PP_WebSocketReadyState_Dev GetReadyState(); | 110 PP_WebSocketReadyState_Dev GetReadyState(); |
| 111 | 111 |
| 112 /// GetURL() returns the URL associated with specified WebSocket connection. | 112 /// GetURL() returns the URL associated with specified WebSocket connection. |
| 113 /// | 113 /// |
| 114 /// @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before | 114 /// @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before |
| 115 /// the connection is established, its data is empty string. | 115 /// the connection is established, its data is empty string. |
| 116 Var GetURL(); | 116 Var GetURL(); |
| 117 | 117 |
| 118 /// OnOpen() is invoked when the connection is established by Connect(). | 118 /// OnOpen() is invoked when the connection is established by Connect(). |
| 119 virtual void OnOpen() = 0; | 119 virtual void OnOpen() = 0; |
| 120 | 120 |
| 121 /// OnMessage() is invoked when a message is received. | 121 /// OnMessage() is invoked when a message is received. |
| 122 virtual void OnMessage(Var message) = 0; | 122 virtual void OnMessage(Var message) = 0; |
| 123 | 123 |
| 124 /// OnError() is invoked if the user agent was required to fail the WebSocket | 124 /// OnError() is invoked if the user agent was required to fail the WebSocket |
| 125 /// connection or the WebSocket connection is closed with prejudice. | 125 /// connection or the WebSocket connection is closed with prejudice. |
| 126 /// OnClose() always follows OnError(). | 126 /// OnClose() always follows OnError(). |
| 127 virtual void OnError() = 0; | 127 virtual void OnError() = 0; |
| 128 | 128 |
| 129 /// OnClose() is invoked when the connection is closed by errors or Close(). | 129 /// OnClose() is invoked when the connection is closed by errors or Close(). |
| 130 virtual void OnClose(bool wasClean, uint16_t code, const Var& reason) = 0; | 130 virtual void OnClose(bool wasClean, uint16_t code, const Var& reason) = 0; |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 } // namespace pp | 133 } // namespace pp |
| 134 | 134 |
| 135 #endif // PPAPI_CPP_DEV_WEBSOCKET_DEV_H_ | 135 #endif // PPAPI_CPP_DEV_WEBSOCKET_DEV_H_ |
| OLD | NEW |