Chromium Code Reviews| 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 | 5 |
| 6 /** | 6 /** |
| 7 * This file defines the <code>PPB_WebSocket</code> interface providing | 7 * This file defines the <code>PPB_WebSocket</code> interface providing |
| 8 * bi-directional, full-duplex, communications over a single TCP socket. | 8 * bi-directional, full-duplex, communications over a single TCP socket. |
| 9 */ | 9 */ |
| 10 label Chrome { | 10 label Chrome { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 * This enumeration contains status codes. These codes are used in Close() and | 49 * This enumeration contains status codes. These codes are used in Close() and |
| 50 * GetCloseCode(). Refer to RFC 6455, The WebSocket Protocol, for further | 50 * GetCloseCode(). Refer to RFC 6455, The WebSocket Protocol, for further |
| 51 * information. | 51 * information. |
| 52 * <code>PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE</code> and codes in the range | 52 * <code>PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE</code> and codes in the range |
| 53 * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN</code> to | 53 * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN</code> to |
| 54 * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX</code>, and | 54 * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX</code>, and |
| 55 * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN</code> to | 55 * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN</code> to |
| 56 * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX</code> are valid for Close(). | 56 * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX</code> are valid for Close(). |
| 57 */ | 57 */ |
| 58 [assert_size(4)] | 58 [assert_size(4)] |
| 59 enum PP_WebSocketCloseCode { | 59 enum PP_WebSocketStatusCode { |
| 60 /** | |
| 61 * Indicates to request closing connection without status code. This code is | |
| 62 * internally assigned in WebKit, and not based on any WebSocket related | |
| 63 * specification. | |
| 64 */ | |
| 65 PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED = -1, | |
| 66 | |
| 60 /** | 67 /** |
| 61 * Status codes in the range 0-999 are not used. | 68 * Status codes in the range 0-999 are not used. |
| 62 */ | 69 */ |
| 63 | 70 |
| 64 /** | 71 /** |
| 65 * Indicates a normal closure. | 72 * Indicates a normal closure. |
| 66 */ | 73 */ |
| 67 PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE = 1000, | 74 PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE = 1000, |
| 68 | 75 |
| 69 /** | 76 /** |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 [in] uint32_t protocol_count, | 244 [in] uint32_t protocol_count, |
| 238 [in] PP_CompletionCallback callback); | 245 [in] PP_CompletionCallback callback); |
| 239 | 246 |
| 240 /** | 247 /** |
| 241 * Close() closes the specified WebSocket connection by specifying | 248 * Close() closes the specified WebSocket connection by specifying |
| 242 * <code>code</code> and <code>reason</code>. | 249 * <code>code</code> and <code>reason</code>. |
| 243 * | 250 * |
| 244 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a | 251 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| 245 * WebSocket. | 252 * WebSocket. |
| 246 * | 253 * |
| 247 * @param[in] code The WebSocket close code. This is ignored if it is 0. | 254 * @param[in] code The WebSocket close code. This is ignored if it is |
|
dmichael (off chromium)
2012/05/15 15:18:33
So, what does ignored mean in this case? When the
Takashi Toyoshima
2012/05/16 09:20:32
When I defined this API, I think I can use '0' to
| |
| 255 * <code>PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED</code>. | |
| 248 * <code>PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE</code> must be used for the | 256 * <code>PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE</code> must be used for the |
| 249 * usual case. To indicate some specific error cases, codes in the range | 257 * usual case. To indicate some specific error cases, codes in the range |
| 250 * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN</code> to | 258 * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN</code> to |
| 251 * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX</code>, and in the range | 259 * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX</code>, and in the range |
| 252 * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN</code> to | 260 * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN</code> to |
| 253 * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX</code> are available. | 261 * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX</code> are available. |
| 254 * | 262 * |
| 255 * @param[in] reason A <code>PP_Var</code> representing the WebSocket | 263 * @param[in] reason A <code>PP_Var</code> representing the WebSocket |
| 256 * close reason. This is ignored if it is <code>PP_VARTYPE_UNDEFINED</code>. | 264 * close reason. This is ignored if it is <code>PP_VARTYPE_UNDEFINED</code>. |
| 257 * Otherwise, its <code>PP_VarType</code> must be | 265 * Otherwise, its <code>PP_VarType</code> must be |
| 258 * <code>PP_VARTYPE_STRING</code>. | 266 * <code>PP_VARTYPE_STRING</code>. |
| 259 * | 267 * |
| 260 * @param[in] callback A <code>PP_CompletionCallback</code> called | 268 * @param[in] callback A <code>PP_CompletionCallback</code> called |
| 261 * when the connection is closed or an error occurs in closing the | 269 * when the connection is closed or an error occurs in closing the |
| 262 * connection. | 270 * connection. |
| 263 * | 271 * |
| 264 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 272 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 265 * Returns <code>PP_ERROR_BADARGUMENT</code> if <code>reason</code> contains | 273 * Returns <code>PP_ERROR_BADARGUMENT</code> if <code>reason</code> contains |
| 266 * an invalid character as a UTF-8 string, or is longer than 123 bytes. | 274 * an invalid character as a UTF-8 string, or is longer than 123 bytes. |
| 267 * <code>PP_ERROR_BADARGUMENT</code> corresponds to a JavaScript SyntaxError | 275 * <code>PP_ERROR_BADARGUMENT</code> corresponds to a JavaScript SyntaxError |
| 268 * in the WebSocket API specification. | 276 * in the WebSocket API specification. |
| 269 * Returns <code>PP_ERROR_NOACCESS</code> if the code is not an integer | 277 * Returns <code>PP_ERROR_NOACCESS</code> if the code is not an integer |
| 270 * equal to 1000 or in the range 3000 to 4999. <code>PP_ERROR_NOACCESS</code> | 278 * equal to 1000 or in the range 3000 to 4999. <code>PP_ERROR_NOACCESS</code> |
| 271 * corresponds to an InvalidAccessError in the WebSocket API specification. | 279 * corresponds to an InvalidAccessError in the WebSocket API specification. |
| 272 * Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to Close() is | 280 * Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to Close() is |
| 273 * not finished. | 281 * not finished. |
| 274 */ | 282 */ |
| 275 int32_t Close([in] PP_Resource web_socket, | 283 int32_t Close([in] PP_Resource web_socket, |
| 276 [in] uint16_t code, | 284 [in] PP_WebSocketStatusCode code, |
|
dmichael (off chromium)
2012/05/15 15:18:33
Ack... I'm sorry, I didn't realize you were using
Takashi Toyoshima
2012/05/16 09:20:32
I guess uint16_t argument is compatible to one of
| |
| 277 [in] PP_Var reason, | 285 [in] PP_Var reason, |
| 278 [in] PP_CompletionCallback callback); | 286 [in] PP_CompletionCallback callback); |
| 279 | 287 |
| 280 /** | 288 /** |
| 281 * ReceiveMessage() receives a message from the WebSocket server. | 289 * ReceiveMessage() receives a message from the WebSocket server. |
| 282 * This interface only returns a single message. That is, this interface must | 290 * This interface only returns a single message. That is, this interface must |
| 283 * be called at least N times to receive N messages, no matter the size of | 291 * be called at least N times to receive N messages, no matter the size of |
| 284 * each message. | 292 * each message. |
| 285 * | 293 * |
| 286 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a | 294 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a | 434 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| 427 * WebSocket. | 435 * WebSocket. |
| 428 * | 436 * |
| 429 * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the | 437 * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the |
| 430 * connection is established, the var contains the empty string. Returns a | 438 * connection is established, the var contains the empty string. Returns a |
| 431 * <code>PP_VARTYPE_UNDEFINED</code> if this function is called on an | 439 * <code>PP_VARTYPE_UNDEFINED</code> if this function is called on an |
| 432 * invalid resource. | 440 * invalid resource. |
| 433 */ | 441 */ |
| 434 PP_Var GetURL([in] PP_Resource web_socket); | 442 PP_Var GetURL([in] PP_Resource web_socket); |
| 435 }; | 443 }; |
| OLD | NEW |