blob: cfc185fbee2ce5ef6e31ca1b125e7f07676fe90d [file] [log] [blame]
{{+bindTo:partials.standard_nacl_api}}
<h1>PPB_WebSocket Struct Reference</h1>
<div id="doxygen-ref">
{{- dummy div to appease doxygen -}}
<div>
<!-- Generated by Doxygen 1.7.6.1 -->
</div>
<!--header-->
<div class="contents">
<!-- doxytag: class="PPB_WebSocket" --><h2>
Data Fields</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___web_socket__1__0.html#a220cff8f5aa9f742d2b9cc4ab0e8de1b">Create</a> )(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___web_socket__1__0.html#afa66d61dd10155dd445a13f1c6280a79">IsWebSocket</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___web_socket__1__0.html#aaff1d1e6f3240e5ce9c772ad80aa38d5">Connect</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> url, const struct <a class="el" href="struct_p_p___var.html">PP_Var</a> protocols[], uint32_t protocol_count, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___web_socket__1__0.html#aa2f3e391713d6097f1d0b2944acab8e8">Close</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket, uint16_t code, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> reason, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___web_socket__1__0.html#aedebd5c21bc451e6b99ea1b2de884122">ReceiveMessage</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> *message, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___web_socket__1__0.html#a05bf8512a7c566f59d527c4a7e92f194">SendMessage</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> message)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint64_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___web_socket__1__0.html#a45b1ad062facdf02199d1879a55c6299">GetBufferedAmount</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint16_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___web_socket__1__0.html#ac0bfae85f51a9e2d5b7fb9660f24968e">GetCloseCode</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___web_socket__1__0.html#aef09f974f4c6ebc9c23a9161ae7c2945">GetCloseReason</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___web_socket__1__0.html#afaf7ee244ffe9aae026b7fbca7a6eff4">GetCloseWasClean</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___web_socket__1__0.html#a71d0d4a01f5e11520d56b668ff178c20">GetExtensions</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___web_socket__1__0.html#a0f5f83152a917998a23e0a10b3a0fa4a">GetProtocol</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#gade61cdf6a7470769b571925694d91a89">PP_WebSocketReadyState</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___web_socket__1__0.html#abd52bebffd4153294734168663057ecc">GetReadyState</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___web_socket__1__0.html#a130ed98f0ebabb614b6637ca6f800e13">GetURL</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket)</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>The <code>PPB_WebSocket</code> interface provides bi-directional, full-duplex, communications over a single TCP socket. </p>
</div><hr /><h2>Field Documentation</h2>
<a class="anchor" id="aa2f3e391713d6097f1d0b2944acab8e8"></a><!-- doxytag: member="PPB_WebSocket::Close" ref="aa2f3e391713d6097f1d0b2944acab8e8" args=")(PP_Resource web_socket, uint16_t code, struct PP_Var reason, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___web_socket__1__0.html#aa2f3e391713d6097f1d0b2944acab8e8">PPB_WebSocket::Close</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket, uint16_t code, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> reason, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___web_socket__1__0.html#aa2f3e391713d6097f1d0b2944acab8e8" title="Close() closes the specified WebSocket connection by specifying code and reason.">Close()</a> closes the specified WebSocket connection by specifying <code>code</code> and <code>reason</code>. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">code</td><td>The WebSocket close code. This is ignored if it is <code>PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED</code>. <code>PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE</code> must be used for the usual case. To indicate some specific error cases, codes in the range <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN</code> to <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX</code>, and in the range <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN</code> to <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX</code> are available.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">reason</td><td>A <code><a class="el" href="struct_p_p___var.html" title="The PP_VAR struct is a variant data type and can contain any value of one of the types named in the P...">PP_Var</a></code> representing the WebSocket close reason. This is ignored if it is <code>PP_VARTYPE_UNDEFINED</code>. Otherwise, its <code>PP_VarType</code> must be <code>PP_VARTYPE_STRING</code>.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> called when the connection is closed or an error occurs in closing the connection.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. Returns <code>PP_ERROR_BADARGUMENT</code> if <code>reason</code> contains an invalid character as a UTF-8 string, or is longer than 123 bytes. <code>PP_ERROR_BADARGUMENT</code> corresponds to a JavaScript SyntaxError in the WebSocket API specification. Returns <code>PP_ERROR_NOACCESS</code> if the code is not an integer equal to 1000 or in the range 3000 to 4999. <code>PP_ERROR_NOACCESS</code> corresponds to an InvalidAccessError in the WebSocket API specification. Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to <a class="el" href="struct_p_p_b___web_socket__1__0.html#aa2f3e391713d6097f1d0b2944acab8e8" title="Close() closes the specified WebSocket connection by specifying code and reason.">Close()</a> is not finished. </dd></dl>
</div>
</div>
<a class="anchor" id="aaff1d1e6f3240e5ce9c772ad80aa38d5"></a><!-- doxytag: member="PPB_WebSocket::Connect" ref="aaff1d1e6f3240e5ce9c772ad80aa38d5" args=")(PP_Resource web_socket, struct PP_Var url, const struct PP_Var protocols[], uint32_t protocol_count, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___web_socket__1__0.html#aaff1d1e6f3240e5ce9c772ad80aa38d5">PPB_WebSocket::Connect</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> url, const struct <a class="el" href="struct_p_p___var.html">PP_Var</a> protocols[], uint32_t protocol_count, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___web_socket__1__0.html#aaff1d1e6f3240e5ce9c772ad80aa38d5" title="Connect() connects to the specified WebSocket server.">Connect()</a> connects to the specified WebSocket server. </p>
<p>You can call this function once for a <code>web_socket</code>.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">url</td><td>A <code><a class="el" href="struct_p_p___var.html" title="The PP_VAR struct is a variant data type and can contain any value of one of the types named in the P...">PP_Var</a></code> representing a WebSocket server URL. The <code>PP_VarType</code> must be <code>PP_VARTYPE_STRING</code>.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">protocols</td><td>A pointer to an array of <code><a class="el" href="struct_p_p___var.html" title="The PP_VAR struct is a variant data type and can contain any value of one of the types named in the P...">PP_Var</a></code> specifying sub-protocols. Each <code><a class="el" href="struct_p_p___var.html" title="The PP_VAR struct is a variant data type and can contain any value of one of the types named in the P...">PP_Var</a></code> represents one sub-protocol and its <code>PP_VarType</code> must be <code>PP_VARTYPE_STRING</code>. This argument can be null only if <code>protocol_count</code> is 0.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">protocol_count</td><td>The number of sub-protocols in <code>protocols</code>.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> called when a connection is established or an error occurs in establishing connection.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. Returns <code>PP_ERROR_BADARGUMENT</code> if the specified <code>url</code>, or <code>protocols</code> contain an invalid string as defined in the WebSocket API specification. <code>PP_ERROR_BADARGUMENT</code> corresponds to a SyntaxError in the WebSocket API specification. Returns <code>PP_ERROR_NOACCESS</code> if the protocol specified in the <code>url</code> is not a secure protocol, but the origin of the caller has a secure scheme. Also returns <code>PP_ERROR_NOACCESS</code> if the port specified in the <code>url</code> is a port that the user agent is configured to block access to because it is a well-known port like SMTP. <code>PP_ERROR_NOACCESS</code> corresponds to a SecurityError of the specification. Returns <code>PP_ERROR_INPROGRESS</code> if this is not the first call to <a class="el" href="struct_p_p_b___web_socket__1__0.html#aaff1d1e6f3240e5ce9c772ad80aa38d5" title="Connect() connects to the specified WebSocket server.">Connect()</a>. </dd></dl>
</div>
</div>
<a class="anchor" id="a220cff8f5aa9f742d2b9cc4ab0e8de1b"></a><!-- doxytag: member="PPB_WebSocket::Create" ref="a220cff8f5aa9f742d2b9cc4ab0e8de1b" args=")(PP_Instance instance)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(* <a class="el" href="struct_p_p_b___web_socket__1__0.html#a220cff8f5aa9f742d2b9cc4ab0e8de1b">PPB_WebSocket::Create</a>)(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___web_socket__1__0.html#a220cff8f5aa9f742d2b9cc4ab0e8de1b" title="Create() creates a WebSocket instance.">Create()</a> creates a WebSocket instance. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>A <code>PP_Instance</code> identifying the instance with the WebSocket.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Resource</code> corresponding to a WebSocket if successful. </dd></dl>
</div>
</div>
<a class="anchor" id="a45b1ad062facdf02199d1879a55c6299"></a><!-- doxytag: member="PPB_WebSocket::GetBufferedAmount" ref="a45b1ad062facdf02199d1879a55c6299" args=")(PP_Resource web_socket)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint64_t(* <a class="el" href="struct_p_p_b___web_socket__1__0.html#a45b1ad062facdf02199d1879a55c6299">PPB_WebSocket::GetBufferedAmount</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___web_socket__1__0.html#a45b1ad062facdf02199d1879a55c6299" title="GetBufferedAmount() returns the number of bytes of text and binary messages that have been queued for...">GetBufferedAmount()</a> returns the number of bytes of text and binary messages that have been queued for the WebSocket connection to send, but have not been transmitted to the network yet. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns the number of bytes. </dd></dl>
</div>
</div>
<a class="anchor" id="ac0bfae85f51a9e2d5b7fb9660f24968e"></a><!-- doxytag: member="PPB_WebSocket::GetCloseCode" ref="ac0bfae85f51a9e2d5b7fb9660f24968e" args=")(PP_Resource web_socket)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint16_t(* <a class="el" href="struct_p_p_b___web_socket__1__0.html#ac0bfae85f51a9e2d5b7fb9660f24968e">PPB_WebSocket::GetCloseCode</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___web_socket__1__0.html#ac0bfae85f51a9e2d5b7fb9660f24968e" title="GetCloseCode() returns the connection close code for the WebSocket connection.">GetCloseCode()</a> returns the connection close code for the WebSocket connection. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns 0 if called before the close code is set. </dd></dl>
</div>
</div>
<a class="anchor" id="aef09f974f4c6ebc9c23a9161ae7c2945"></a><!-- doxytag: member="PPB_WebSocket::GetCloseReason" ref="aef09f974f4c6ebc9c23a9161ae7c2945" args=")(PP_Resource web_socket)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(* <a class="el" href="struct_p_p_b___web_socket__1__0.html#aef09f974f4c6ebc9c23a9161ae7c2945">PPB_WebSocket::GetCloseReason</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket)<code> [read]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___web_socket__1__0.html#aef09f974f4c6ebc9c23a9161ae7c2945" title="GetCloseReason() returns the connection close reason for the WebSocket connection.">GetCloseReason()</a> returns the connection close reason for the WebSocket connection. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns a <code>PP_VARTYPE_STRING</code> var. If called before the close reason is set, the return value contains an empty string. Returns a <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. </dd></dl>
</div>
</div>
<a class="anchor" id="afaf7ee244ffe9aae026b7fbca7a6eff4"></a><!-- doxytag: member="PPB_WebSocket::GetCloseWasClean" ref="afaf7ee244ffe9aae026b7fbca7a6eff4" args=")(PP_Resource web_socket)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___web_socket__1__0.html#afaf7ee244ffe9aae026b7fbca7a6eff4">PPB_WebSocket::GetCloseWasClean</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___web_socket__1__0.html#afaf7ee244ffe9aae026b7fbca7a6eff4" title="GetCloseWasClean() returns if the connection was closed cleanly for the specified WebSocket connectio...">GetCloseWasClean()</a> returns if the connection was closed cleanly for the specified WebSocket connection. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns <code>PP_FALSE</code> if called before the connection is closed, called on an invalid resource, or closed for abnormal reasons. Otherwise, returns <code>PP_TRUE</code> if the connection was closed cleanly. </dd></dl>
</div>
</div>
<a class="anchor" id="a71d0d4a01f5e11520d56b668ff178c20"></a><!-- doxytag: member="PPB_WebSocket::GetExtensions" ref="a71d0d4a01f5e11520d56b668ff178c20" args=")(PP_Resource web_socket)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(* <a class="el" href="struct_p_p_b___web_socket__1__0.html#a71d0d4a01f5e11520d56b668ff178c20">PPB_WebSocket::GetExtensions</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket)<code> [read]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___web_socket__1__0.html#a71d0d4a01f5e11520d56b668ff178c20" title="GetExtensions() returns the extensions selected by the server for the specified WebSocket connection...">GetExtensions()</a> returns the extensions selected by the server for the specified WebSocket connection. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns a <code>PP_VARTYPE_STRING</code> var. If called before the connection is established, the var's data is an empty string. Returns a <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. </dd></dl>
</div>
</div>
<a class="anchor" id="a0f5f83152a917998a23e0a10b3a0fa4a"></a><!-- doxytag: member="PPB_WebSocket::GetProtocol" ref="a0f5f83152a917998a23e0a10b3a0fa4a" args=")(PP_Resource web_socket)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(* <a class="el" href="struct_p_p_b___web_socket__1__0.html#a0f5f83152a917998a23e0a10b3a0fa4a">PPB_WebSocket::GetProtocol</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket)<code> [read]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___web_socket__1__0.html#a0f5f83152a917998a23e0a10b3a0fa4a" title="GetProtocol() returns the sub-protocol chosen by the server for the specified WebSocket connection...">GetProtocol()</a> returns the sub-protocol chosen by the server for the specified WebSocket connection. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns a <code>PP_VARTYPE_STRING</code> var. If called before the connection is established, the var contains the empty string. Returns a <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. </dd></dl>
</div>
</div>
<a class="anchor" id="abd52bebffd4153294734168663057ecc"></a><!-- doxytag: member="PPB_WebSocket::GetReadyState" ref="abd52bebffd4153294734168663057ecc" args=")(PP_Resource web_socket)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#gade61cdf6a7470769b571925694d91a89">PP_WebSocketReadyState</a>(* <a class="el" href="struct_p_p_b___web_socket__1__0.html#abd52bebffd4153294734168663057ecc">PPB_WebSocket::GetReadyState</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___web_socket__1__0.html#abd52bebffd4153294734168663057ecc" title="GetReadyState() returns the ready state of the specified WebSocket connection.">GetReadyState()</a> returns the ready state of the specified WebSocket connection. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns <code>PP_WEBSOCKETREADYSTATE_INVALID</code> if called before <a class="el" href="struct_p_p_b___web_socket__1__0.html#aaff1d1e6f3240e5ce9c772ad80aa38d5" title="Connect() connects to the specified WebSocket server.">Connect()</a> is called, or if this function is called on an invalid resource. </dd></dl>
</div>
</div>
<a class="anchor" id="a130ed98f0ebabb614b6637ca6f800e13"></a><!-- doxytag: member="PPB_WebSocket::GetURL" ref="a130ed98f0ebabb614b6637ca6f800e13" args=")(PP_Resource web_socket)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(* <a class="el" href="struct_p_p_b___web_socket__1__0.html#a130ed98f0ebabb614b6637ca6f800e13">PPB_WebSocket::GetURL</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket)<code> [read]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___web_socket__1__0.html#a130ed98f0ebabb614b6637ca6f800e13" title="GetURL() returns the URL associated with specified WebSocket connection.">GetURL()</a> returns the URL associated with specified WebSocket connection. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns a <code>PP_VARTYPE_STRING</code> var. If called before the connection is established, the var contains the empty string. Returns a <code>PP_VARTYPE_UNDEFINED</code> if this function is called on an invalid resource. </dd></dl>
</div>
</div>
<a class="anchor" id="afa66d61dd10155dd445a13f1c6280a79"></a><!-- doxytag: member="PPB_WebSocket::IsWebSocket" ref="afa66d61dd10155dd445a13f1c6280a79" args=")(PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___web_socket__1__0.html#afa66d61dd10155dd445a13f1c6280a79">PPB_WebSocket::IsWebSocket</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___web_socket__1__0.html#afa66d61dd10155dd445a13f1c6280a79" title="IsWebSocket() determines if the provided resource is a WebSocket instance.">IsWebSocket()</a> determines if the provided <code>resource</code> is a WebSocket instance. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns <code>PP_TRUE</code> if <code>resource</code> is a <code>PPB_WebSocket</code>, <code>PP_FALSE</code> if the <code>resource</code> is invalid or some type other than <code>PPB_WebSocket</code>. </dd></dl>
</div>
</div>
<a class="anchor" id="aedebd5c21bc451e6b99ea1b2de884122"></a><!-- doxytag: member="PPB_WebSocket::ReceiveMessage" ref="aedebd5c21bc451e6b99ea1b2de884122" args=")(PP_Resource web_socket, struct PP_Var *message, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___web_socket__1__0.html#aedebd5c21bc451e6b99ea1b2de884122">PPB_WebSocket::ReceiveMessage</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> *message, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___web_socket__1__0.html#aedebd5c21bc451e6b99ea1b2de884122" title="ReceiveMessage() receives a message from the WebSocket server.">ReceiveMessage()</a> receives a message from the WebSocket server. </p>
<p>This interface only returns a single message. That is, this interface must be called at least N times to receive N messages, no matter the size of each message.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">message</td><td>The received message is copied to provided <code>message</code>. The <code>message</code> must remain valid until <a class="el" href="struct_p_p_b___web_socket__1__0.html#aedebd5c21bc451e6b99ea1b2de884122" title="ReceiveMessage() receives a message from the WebSocket server.">ReceiveMessage()</a> completes. Its received <code>PP_VarType</code> will be <code>PP_VARTYPE_STRING</code> or <code>PP_VARTYPE_ARRAY_BUFFER</code>.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> called when <a class="el" href="struct_p_p_b___web_socket__1__0.html#aedebd5c21bc451e6b99ea1b2de884122" title="ReceiveMessage() receives a message from the WebSocket server.">ReceiveMessage()</a> completes. This callback is ignored if <a class="el" href="struct_p_p_b___web_socket__1__0.html#aedebd5c21bc451e6b99ea1b2de884122" title="ReceiveMessage() receives a message from the WebSocket server.">ReceiveMessage()</a> completes synchronously and returns <code>PP_OK</code>.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. If an error is detected or connection is closed, <a class="el" href="struct_p_p_b___web_socket__1__0.html#aedebd5c21bc451e6b99ea1b2de884122" title="ReceiveMessage() receives a message from the WebSocket server.">ReceiveMessage()</a> returns <code>PP_ERROR_FAILED</code> after all buffered messages are received. Until buffered message become empty, <a class="el" href="struct_p_p_b___web_socket__1__0.html#aedebd5c21bc451e6b99ea1b2de884122" title="ReceiveMessage() receives a message from the WebSocket server.">ReceiveMessage()</a> continues to return <code>PP_OK</code> as if connection is still established without errors. </dd></dl>
</div>
</div>
<a class="anchor" id="a05bf8512a7c566f59d527c4a7e92f194"></a><!-- doxytag: member="PPB_WebSocket::SendMessage" ref="a05bf8512a7c566f59d527c4a7e92f194" args=")(PP_Resource web_socket, struct PP_Var message)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___web_socket__1__0.html#a05bf8512a7c566f59d527c4a7e92f194">PPB_WebSocket::SendMessage</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> web_socket, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> message)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___web_socket__1__0.html#a05bf8512a7c566f59d527c4a7e92f194" title="SendMessage() sends a message to the WebSocket server.">SendMessage()</a> sends a message to the WebSocket server. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">message</td><td>A message to send. The message is copied to an internal buffer, so the caller can free <code>message</code> safely after returning from the function. Its sent <code>PP_VarType</code> must be <code>PP_VARTYPE_STRING</code> or <code>PP_VARTYPE_ARRAY_BUFFER</code>.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. Returns <code>PP_ERROR_FAILED</code> if the ReadyState is <code>PP_WEBSOCKETREADYSTATE_CONNECTING</code>. <code>PP_ERROR_FAILED</code> corresponds to a JavaScript InvalidStateError in the WebSocket API specification. Returns <code>PP_ERROR_BADARGUMENT</code> if the provided <code>message</code> contains an invalid character as a UTF-8 string. <code>PP_ERROR_BADARGUMENT</code> corresponds to a JavaScript SyntaxError in the WebSocket API specification. Otherwise, returns <code>PP_OK</code>, which doesn't necessarily mean that the server received the message. </dd></dl>
</div>
</div>
<hr />The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="ppb__websocket_8h.html">ppb_websocket.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}