struct_p_p_b___web_socket__1__0.html revision cedac228d2dd51db4b79ea1e72c7f249408ee061
1{{+bindTo:partials.standard_nacl_api}} 2<h1>PPB_WebSocket Struct Reference</h1> 3<div id="doxygen-ref"> 4{{- dummy div to appease doxygen -}} 5 <div> 6<!-- Generated by Doxygen 1.7.6.1 --> 7 8 9</div> 10<!--header--> 11<div class="contents"> 12<!-- doxytag: class="PPB_WebSocket" --><h2> 13Data Fields</h2><table class="memberdecls"> 14 15<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(* </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> 16<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* </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> 17<tr><td class="memItemLeft" align="right" valign="top">int32_t(* </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> 18<tr><td class="memItemLeft" align="right" valign="top">int32_t(* </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> 19<tr><td class="memItemLeft" align="right" valign="top">int32_t(* </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> 20<tr><td class="memItemLeft" align="right" valign="top">int32_t(* </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> 21<tr><td class="memItemLeft" align="right" valign="top">uint64_t(* </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> 22<tr><td class="memItemLeft" align="right" valign="top">uint16_t(* </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> 23<tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(* </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> 24<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* </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> 25<tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(* </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> 26<tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(* </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> 27<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#gade61cdf6a7470769b571925694d91a89">PP_WebSocketReadyState</a>(* </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> 28<tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(* </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> 29</table> 30<hr /><a name="details" id="details"></a><h2>Detailed Description</h2> 31<div class="textblock"><p>The <code>PPB_WebSocket</code> interface provides bi-directional, full-duplex, communications over a single TCP socket. </p> 32</div><hr /><h2>Field Documentation</h2> 33<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)" --> 34<div class="memitem"> 35<div class="memproto"> 36<table class="memname"> 37<tr> 38<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> 39</tr> 40</table> 41</div> 42<div class="memdoc"> 43<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> 44<dl class="params"><dt><b>Parameters:</b></dt><dd> 45<table class="params"> 46<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr> 47<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> 48<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> 49<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> 50</table> 51</dd> 52</dl> 53<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> 54</div> 55</div> 56<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)" --> 57<div class="memitem"> 58<div class="memproto"> 59<table class="memname"> 60<tr> 61<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> 62</tr> 63</table> 64</div> 65<div class="memdoc"> 66<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> 67<p>You can call this function once for a <code>web_socket</code>.</p> 68<dl class="params"><dt><b>Parameters:</b></dt><dd> 69<table class="params"> 70<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr> 71<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> 72<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> 73<tr><td class="paramdir">[in]</td><td class="paramname">protocol_count</td><td>The number of sub-protocols in <code>protocols</code>.</td></tr> 74<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> 75</table> 76</dd> 77</dl> 78<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> 79</div> 80</div> 81<a class="anchor" id="a220cff8f5aa9f742d2b9cc4ab0e8de1b"></a><!-- doxytag: member="PPB_WebSocket::Create" ref="a220cff8f5aa9f742d2b9cc4ab0e8de1b" args=")(PP_Instance instance)" --> 82<div class="memitem"> 83<div class="memproto"> 84<table class="memname"> 85<tr> 86<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> 87</tr> 88</table> 89</div> 90<div class="memdoc"> 91<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> 92<dl class="params"><dt><b>Parameters:</b></dt><dd> 93<table class="params"> 94<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> 95</table> 96</dd> 97</dl> 98<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Resource</code> corresponding to a WebSocket if successful. </dd></dl> 99</div> 100</div> 101<a class="anchor" id="a45b1ad062facdf02199d1879a55c6299"></a><!-- doxytag: member="PPB_WebSocket::GetBufferedAmount" ref="a45b1ad062facdf02199d1879a55c6299" args=")(PP_Resource web_socket)" --> 102<div class="memitem"> 103<div class="memproto"> 104<table class="memname"> 105<tr> 106<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> 107</tr> 108</table> 109</div> 110<div class="memdoc"> 111<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> 112<dl class="params"><dt><b>Parameters:</b></dt><dd> 113<table class="params"> 114<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr> 115</table> 116</dd> 117</dl> 118<dl class="return"><dt><b>Returns:</b></dt><dd>Returns the number of bytes. </dd></dl> 119</div> 120</div> 121<a class="anchor" id="ac0bfae85f51a9e2d5b7fb9660f24968e"></a><!-- doxytag: member="PPB_WebSocket::GetCloseCode" ref="ac0bfae85f51a9e2d5b7fb9660f24968e" args=")(PP_Resource web_socket)" --> 122<div class="memitem"> 123<div class="memproto"> 124<table class="memname"> 125<tr> 126<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> 127</tr> 128</table> 129</div> 130<div class="memdoc"> 131<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> 132<dl class="params"><dt><b>Parameters:</b></dt><dd> 133<table class="params"> 134<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr> 135</table> 136</dd> 137</dl> 138<dl class="return"><dt><b>Returns:</b></dt><dd>Returns 0 if called before the close code is set. </dd></dl> 139</div> 140</div> 141<a class="anchor" id="aef09f974f4c6ebc9c23a9161ae7c2945"></a><!-- doxytag: member="PPB_WebSocket::GetCloseReason" ref="aef09f974f4c6ebc9c23a9161ae7c2945" args=")(PP_Resource web_socket)" --> 142<div class="memitem"> 143<div class="memproto"> 144<table class="memname"> 145<tr> 146<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> 147</tr> 148</table> 149</div> 150<div class="memdoc"> 151<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> 152<dl class="params"><dt><b>Parameters:</b></dt><dd> 153<table class="params"> 154<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr> 155</table> 156</dd> 157</dl> 158<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> 159</div> 160</div> 161<a class="anchor" id="afaf7ee244ffe9aae026b7fbca7a6eff4"></a><!-- doxytag: member="PPB_WebSocket::GetCloseWasClean" ref="afaf7ee244ffe9aae026b7fbca7a6eff4" args=")(PP_Resource web_socket)" --> 162<div class="memitem"> 163<div class="memproto"> 164<table class="memname"> 165<tr> 166<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> 167</tr> 168</table> 169</div> 170<div class="memdoc"> 171<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> 172<dl class="params"><dt><b>Parameters:</b></dt><dd> 173<table class="params"> 174<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr> 175</table> 176</dd> 177</dl> 178<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> 179</div> 180</div> 181<a class="anchor" id="a71d0d4a01f5e11520d56b668ff178c20"></a><!-- doxytag: member="PPB_WebSocket::GetExtensions" ref="a71d0d4a01f5e11520d56b668ff178c20" args=")(PP_Resource web_socket)" --> 182<div class="memitem"> 183<div class="memproto"> 184<table class="memname"> 185<tr> 186<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> 187</tr> 188</table> 189</div> 190<div class="memdoc"> 191<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> 192<dl class="params"><dt><b>Parameters:</b></dt><dd> 193<table class="params"> 194<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr> 195</table> 196</dd> 197</dl> 198<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> 199</div> 200</div> 201<a class="anchor" id="a0f5f83152a917998a23e0a10b3a0fa4a"></a><!-- doxytag: member="PPB_WebSocket::GetProtocol" ref="a0f5f83152a917998a23e0a10b3a0fa4a" args=")(PP_Resource web_socket)" --> 202<div class="memitem"> 203<div class="memproto"> 204<table class="memname"> 205<tr> 206<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> 207</tr> 208</table> 209</div> 210<div class="memdoc"> 211<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> 212<dl class="params"><dt><b>Parameters:</b></dt><dd> 213<table class="params"> 214<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr> 215</table> 216</dd> 217</dl> 218<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> 219</div> 220</div> 221<a class="anchor" id="abd52bebffd4153294734168663057ecc"></a><!-- doxytag: member="PPB_WebSocket::GetReadyState" ref="abd52bebffd4153294734168663057ecc" args=")(PP_Resource web_socket)" --> 222<div class="memitem"> 223<div class="memproto"> 224<table class="memname"> 225<tr> 226<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> 227</tr> 228</table> 229</div> 230<div class="memdoc"> 231<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> 232<dl class="params"><dt><b>Parameters:</b></dt><dd> 233<table class="params"> 234<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr> 235</table> 236</dd> 237</dl> 238<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> 239</div> 240</div> 241<a class="anchor" id="a130ed98f0ebabb614b6637ca6f800e13"></a><!-- doxytag: member="PPB_WebSocket::GetURL" ref="a130ed98f0ebabb614b6637ca6f800e13" args=")(PP_Resource web_socket)" --> 242<div class="memitem"> 243<div class="memproto"> 244<table class="memname"> 245<tr> 246<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> 247</tr> 248</table> 249</div> 250<div class="memdoc"> 251<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> 252<dl class="params"><dt><b>Parameters:</b></dt><dd> 253<table class="params"> 254<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr> 255</table> 256</dd> 257</dl> 258<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> 259</div> 260</div> 261<a class="anchor" id="afa66d61dd10155dd445a13f1c6280a79"></a><!-- doxytag: member="PPB_WebSocket::IsWebSocket" ref="afa66d61dd10155dd445a13f1c6280a79" args=")(PP_Resource resource)" --> 262<div class="memitem"> 263<div class="memproto"> 264<table class="memname"> 265<tr> 266<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> 267</tr> 268</table> 269</div> 270<div class="memdoc"> 271<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> 272<dl class="params"><dt><b>Parameters:</b></dt><dd> 273<table class="params"> 274<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr> 275</table> 276</dd> 277</dl> 278<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> 279</div> 280</div> 281<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)" --> 282<div class="memitem"> 283<div class="memproto"> 284<table class="memname"> 285<tr> 286<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> 287</tr> 288</table> 289</div> 290<div class="memdoc"> 291<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> 292<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> 293<dl class="params"><dt><b>Parameters:</b></dt><dd> 294<table class="params"> 295<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr> 296<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> 297<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> 298</table> 299</dd> 300</dl> 301<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> 302</div> 303</div> 304<a class="anchor" id="a05bf8512a7c566f59d527c4a7e92f194"></a><!-- doxytag: member="PPB_WebSocket::SendMessage" ref="a05bf8512a7c566f59d527c4a7e92f194" args=")(PP_Resource web_socket, struct PP_Var message)" --> 305<div class="memitem"> 306<div class="memproto"> 307<table class="memname"> 308<tr> 309<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> 310</tr> 311</table> 312</div> 313<div class="memdoc"> 314<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> 315<dl class="params"><dt><b>Parameters:</b></dt><dd> 316<table class="params"> 317<tr><td class="paramdir">[in]</td><td class="paramname">web_socket</td><td>A <code>PP_Resource</code> corresponding to a WebSocket.</td></tr> 318<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> 319</table> 320</dd> 321</dl> 322<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> 323</div> 324</div> 325<hr />The documentation for this struct was generated from the following file:<ul> 326<li><a class="el" href="ppb__websocket_8h.html">ppb_websocket.h</a></li> 327</ul> 328</div><!-- contents --> 329</div> 330{{/partials.standard_nacl_api}} 331