| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 * connection. | 216 * connection. |
| 217 * | 217 * |
| 218 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 218 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 219 * Returns <code>PP_ERROR_BADARGUMENT</code> if the specified | 219 * Returns <code>PP_ERROR_BADARGUMENT</code> if the specified |
| 220 * <code>url</code>, or <code>protocols</code> contain an invalid string as | 220 * <code>url</code>, or <code>protocols</code> contain an invalid string as |
| 221 * defined in the WebSocket API specification. | 221 * defined in the WebSocket API specification. |
| 222 * <code>PP_ERROR_BADARGUMENT</code> corresponds to a SyntaxError in the | 222 * <code>PP_ERROR_BADARGUMENT</code> corresponds to a SyntaxError in the |
| 223 * WebSocket API specification. | 223 * WebSocket API specification. |
| 224 * Returns <code>PP_ERROR_NOACCESS</code> if the protocol specified in the | 224 * Returns <code>PP_ERROR_NOACCESS</code> if the protocol specified in the |
| 225 * <code>url</code> is not a secure protocol, but the origin of the caller | 225 * <code>url</code> is not a secure protocol, but the origin of the caller |
| 226 * has a secure scheme. Also returns <code>PP_ERROR_NOACCESS</CODE> if the | 226 * has a secure scheme. Also returns <code>PP_ERROR_NOACCESS</code> if the |
| 227 * port specified in the <code>url</code> is a port that the user agent | 227 * port specified in the <code>url</code> is a port that the user agent |
| 228 * is configured to block access to because it is a well-known port like | 228 * is configured to block access to because it is a well-known port like |
| 229 * SMTP. <code>PP_ERROR_NOACCESS</code> corresponds to SecurityError of the | 229 * SMTP. <code>PP_ERROR_NOACCESS</code> corresponds to SecurityError of the |
| 230 * specification. | 230 * specification. |
| 231 * Returns <code>PP_ERROR_INPROGRESS</code> if this is not the first call to | 231 * Returns <code>PP_ERROR_INPROGRESS</code> if this is not the first call to |
| 232 * Connect(). | 232 * Connect(). |
| 233 */ | 233 */ |
| 234 int32_t Connect([in] PP_Resource web_socket, | 234 int32_t Connect([in] PP_Resource web_socket, |
| 235 [in] PP_Var url, | 235 [in] PP_Var url, |
| 236 [in, size_as=protocol_count] PP_Var[] protocols, | 236 [in, size_as=protocol_count] PP_Var[] protocols, |
| 237 [in] uint32_t protocol_count, | 237 [in] uint32_t protocol_count, |
| 238 [in] PP_CompletionCallback callback); | 238 [in] PP_CompletionCallback callback); |
| 239 | 239 |
| 240 /** | 240 /** |
| 241 * Close() closes the specified WebSocket connection by specifying | 241 * Close() closes the specified WebSocket connection by specifying |
| 242 * <code>code</code> and <code>reason</code>. | 242 * <code>code</code> and <code>reason</code>. |
| 243 * | 243 * |
| 244 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a | 244 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| 245 * WebSocket. | 245 * WebSocket. |
| 246 * | 246 * |
| 247 * @param[in] code The WebSocket close code. Ignored if it is 0. | 247 * @param[in] code The WebSocket close code. This is ignored if it is 0. |
| 248 * <code>PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE</code> must be used for the | 248 * <code>PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE</code> must be used for the |
| 249 * usual case. To indicate some specific error cases, codes in the range | 249 * usual case. To indicate some specific error cases, codes in the range |
| 250 * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN</code> to | 250 * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN</code> to |
| 251 * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX</code>, and in the range | 251 * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX</code>, and in the range |
| 252 * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN</code> to | 252 * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN</code> to |
| 253 * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX</code> are available. | 253 * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX</code> are available. |
| 254 * | 254 * |
| 255 * @param[in] reason A <code>PP_Var</code> representing the WebSocket | 255 * @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>. | 256 * close reason. This is ignored if it is <code>PP_VARTYPE_UNDEFINED</code>. |
| 257 * Otherwise, its <code>PP_VarType</code> must be | 257 * Otherwise, its <code>PP_VarType</code> must be |
| 258 * <code>PP_VARTYPE_STRING</code>. | 258 * <code>PP_VARTYPE_STRING</code>. |
| 259 * | 259 * |
| 260 * @param[in] callback A <code>PP_CompletionCallback</code> called | 260 * @param[in] callback A <code>PP_CompletionCallback</code> called |
| 261 * when the connection is closed or an error occurs in closing the | 261 * when the connection is closed or an error occurs in closing the |
| 262 * connection. | 262 * connection. |
| 263 * | 263 * |
| 264 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 264 * @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 | 265 * 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. | 266 * 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 | 267 * <code>PP_ERROR_BADARGUMENT</code> corresponds to a JavaScript SyntaxError |
| 268 * in the WebSocket API specification. | 268 * in the WebSocket API specification. |
| 269 * Returns <code>PP_ERROR_NOACCESS</code> if the code is not an integer | 269 * 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> | 270 * equal to 1000 or in the range 3000 to 4999. <code>PP_ERROR_NOACCESS</code> |
| 271 * corresponds to InvalidAccessError of the specification. Returns | 271 * corresponds to InvalidAccessError in the WebSocket API specification. |
| 272 * <code>PP_ERROR_INPROGRESS</code> if this is not the first call to | 272 * Returns <code>PP_ERROR_INPROGRESS</code> if this is not the first call to |
| 273 * Close(). | 273 * Close(). |
| 274 */ | 274 */ |
| 275 int32_t Close([in] PP_Resource web_socket, | 275 int32_t Close([in] PP_Resource web_socket, |
| 276 [in] uint16_t code, | 276 [in] uint16_t code, |
| 277 [in] PP_Var reason, | 277 [in] PP_Var reason, |
| 278 [in] PP_CompletionCallback callback); | 278 [in] PP_CompletionCallback callback); |
| 279 | 279 |
| 280 /** | 280 /** |
| 281 * ReceiveMessage() receives a message from the WebSocket server. | 281 * ReceiveMessage() receives a message from the WebSocket server. |
| 282 * This interface only returns a single message. That is, this interface must | 282 * This interface only returns a single message. That is, this interface must |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a | 426 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| 427 * WebSocket. | 427 * WebSocket. |
| 428 * | 428 * |
| 429 * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the | 429 * @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 | 430 * connection is established, the var contains the empty string. Returns a |
| 431 * <code>PP_VARTYPE_UNDEFINED</code> if this function is called on an | 431 * <code>PP_VARTYPE_UNDEFINED</code> if this function is called on an |
| 432 * invalid resource. | 432 * invalid resource. |
| 433 */ | 433 */ |
| 434 PP_Var GetURL([in] PP_Resource web_socket); | 434 PP_Var GetURL([in] PP_Resource web_socket); |
| 435 }; | 435 }; |
| OLD | NEW |