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