Upstream version 5.34.92.0
[platform/framework/web/crosswalk.git] / src / native_client_sdk / doc_generated / pepper_dev / cpp / classpp_1_1_web_socket.html
1 {{+bindTo:partials.standard_nacl_article}}
2 <h1>pp::WebSocket Class Reference</h1>
3 <div>
4 <!-- Generated by Doxygen 1.7.6.1 -->
5
6
7
8 </div>
9 <!--header-->
10 <div class="contents">
11 <!-- doxytag: class="pp::WebSocket" --><!-- doxytag: inherits="pp::Resource" --><div class="dynheader">
12 Inheritance diagram for pp::WebSocket:</div>
13 <div class="dyncontent">
14 <div class="center"><img src="classpp_1_1_web_socket__inherit__graph.png" border="0" usemap="#pp_1_1_web_socket_inherit__map" alt="Inheritance graph" /></div>
15 <map name="pp_1_1_web_socket_inherit__map" id="pp_1_1_web_socket_inherit__map">
16 <area shape="rect" id="node2" href="classpp_1_1_resource.html" title="A reference counted module resource." alt="" coords="11,5,115,35"></area></map>
17 <center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
18 <p><a href="classpp_1_1_web_socket-members.html">List of all members.</a></p>
19 <h2>
20 Public Member Functions</h2><table class="memberdecls">
21
22 <tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_web_socket.html#aeaac3a412a9015a9378beec9f42d5809">WebSocket</a> (const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> &amp;instance)</td></tr>
23 <tr><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_web_socket.html#aa4810e4b945c1fc92493dc206eb35c09">~WebSocket</a> ()</td></tr>
24 <tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_web_socket.html#ad8471399bfca7df23b87ded733d53141">Connect</a> (const <a class="el" href="classpp_1_1_var.html">Var</a> &amp;url, const <a class="el" href="classpp_1_1_var.html">Var</a> protocols[], uint32_t protocol_count, const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;callback)</td></tr>
25 <tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_web_socket.html#ae7913ea4019cc2a10c9a0390c5959071">Close</a> (uint16_t code, const <a class="el" href="classpp_1_1_var.html">Var</a> &amp;reason, const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;callback)</td></tr>
26 <tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_web_socket.html#a1eb972115700589ebf6998db4f411c56">ReceiveMessage</a> (<a class="el" href="classpp_1_1_var.html">Var</a> *message, const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;callback)</td></tr>
27 <tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_web_socket.html#a276b1aae76ba9d899475aaf9c2cd4f28">SendMessage</a> (const <a class="el" href="classpp_1_1_var.html">Var</a> &amp;message)</td></tr>
28 <tr><td class="memItemLeft" align="right" valign="top">uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_web_socket.html#aee920e33ef266c51ffdaeba8d6924e19">GetBufferedAmount</a> ()</td></tr>
29 <tr><td class="memItemLeft" align="right" valign="top">uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_web_socket.html#ab1bb565b7800fd3c147177e4e3a3466f">GetCloseCode</a> ()</td></tr>
30 <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classpp_1_1_var.html">Var</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_web_socket.html#a27c9cf6d130706fcc5e6fe2f9ed51a7b">GetCloseReason</a> ()</td></tr>
31 <tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_web_socket.html#a092b63f716b3e02fc8ec0696ac58df84">GetCloseWasClean</a> ()</td></tr>
32 <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classpp_1_1_var.html">Var</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_web_socket.html#ab22093b22b7ceea6957047e1cb5967d2">GetExtensions</a> ()</td></tr>
33 <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classpp_1_1_var.html">Var</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_web_socket.html#a1c4b81bb05d30fdef67a07ac904abf0f">GetProtocol</a> ()</td></tr>
34 <tr><td class="memItemLeft" align="right" valign="top">PP_WebSocketReadyState&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_web_socket.html#afa09ce5acb5f7f168f17b8b3f5939317">GetReadyState</a> ()</td></tr>
35 <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classpp_1_1_var.html">Var</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_web_socket.html#ab76ccebfe20facff03464e71f4af7719">GetURL</a> ()</td></tr>
36 </table>
37 <hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
38 <div class="textblock"><p>The <code><a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a></code> class providing bi-directional, full-duplex, communications over a single TCP socket. </p>
39 </div><hr /><h2>Constructor &amp; Destructor Documentation</h2>
40 <a class="anchor" id="aeaac3a412a9015a9378beec9f42d5809"></a><!-- doxytag: member="pp::WebSocket::WebSocket" ref="aeaac3a412a9015a9378beec9f42d5809" args="(const InstanceHandle &amp;instance)" -->
41 <div class="memitem">
42 <div class="memproto">
43 <table class="memname">
44 <tr>
45 <td class="memname"><a class="el" href="classpp_1_1_web_socket.html#aeaac3a412a9015a9378beec9f42d5809">pp::WebSocket::WebSocket</a> </td>
46 <td>(</td>
47 <td class="paramtype">const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> &amp;&#160;</td>
48 <td class="paramname"><em>instance</em></td><td>)</td>
49 <td><code> [explicit]</code></td>
50 </tr>
51 </table>
52 </div>
53 <div class="memdoc">
54 <p>Constructs a <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> object. </p>
55 <dl class="params"><dt><b>Parameters:</b></dt><dd>
56 <table class="params">
57 <tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>The instance with which this resource will be associated. </td></tr>
58 </table>
59 </dd>
60 </dl>
61 </div>
62 </div>
63 <a class="anchor" id="aa4810e4b945c1fc92493dc206eb35c09"></a><!-- doxytag: member="pp::WebSocket::~WebSocket" ref="aa4810e4b945c1fc92493dc206eb35c09" args="()" -->
64 <div class="memitem">
65 <div class="memproto">
66 <table class="memname">
67 <tr>
68 <td class="memname">virtual <a class="el" href="classpp_1_1_web_socket.html#aa4810e4b945c1fc92493dc206eb35c09">pp::WebSocket::~WebSocket</a> </td>
69 <td>(</td>
70 <td class="paramname"></td><td>)</td>
71 <td><code> [virtual]</code></td>
72 </tr>
73 </table>
74 </div>
75 <div class="memdoc">
76 <p>Destructs a <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> object. </p>
77 </div>
78 </div>
79 <hr /><h2>Member Function Documentation</h2>
80 <a class="anchor" id="ae7913ea4019cc2a10c9a0390c5959071"></a><!-- doxytag: member="pp::WebSocket::Close" ref="ae7913ea4019cc2a10c9a0390c5959071" args="(uint16_t code, const Var &amp;reason, const CompletionCallback &amp;callback)" -->
81 <div class="memitem">
82 <div class="memproto">
83 <table class="memname">
84 <tr>
85 <td class="memname">int32_t <a class="el" href="classpp_1_1_web_socket.html#ae7913ea4019cc2a10c9a0390c5959071">pp::WebSocket::Close</a> </td>
86 <td>(</td>
87 <td class="paramtype">uint16_t&#160;</td>
88 <td class="paramname"><em>code</em>, </td>
89 </tr>
90 <tr>
91 <td class="paramkey"></td>
92 <td></td>
93 <td class="paramtype">const <a class="el" href="classpp_1_1_var.html">Var</a> &amp;&#160;</td>
94 <td class="paramname"><em>reason</em>, </td>
95 </tr>
96 <tr>
97 <td class="paramkey"></td>
98 <td></td>
99 <td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;&#160;</td>
100 <td class="paramname"><em>callback</em>&#160;</td>
101 </tr>
102 <tr>
103 <td></td>
104 <td>)</td>
105 <td></td><td></td>
106 </tr>
107 </table>
108 </div>
109 <div class="memdoc">
110 <p><a class="el" href="classpp_1_1_web_socket.html#ae7913ea4019cc2a10c9a0390c5959071" title="Close() closes the specified WebSocket connection by specifying code and reason.">Close()</a> closes the specified <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> connection by specifying <code>code</code> and <code>reason</code>. </p>
111 <dl class="params"><dt><b>Parameters:</b></dt><dd>
112 <table class="params">
113 <tr><td class="paramdir">[in]</td><td class="paramname">code</td><td>The <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> close code. This is ignored if it is 0. <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>
114 <tr><td class="paramdir">[in]</td><td class="paramname">reason</td><td>A <code><a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a></code> of string type representing the close reason. This is ignored if it is an undefined type.</td></tr>
115 <tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="classpp_1_1_completion_callback.html" title="This API enables you to implement and receive callbacks when Pepper operations complete asynchronousl...">CompletionCallback</a></code> called when the connection is closed or an error occurs in closing the connection.</td></tr>
116 </table>
117 </dd>
118 </dl>
119 <dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code>pp_errors.h</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 <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> 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 <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> API specification. Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to <a class="el" href="classpp_1_1_web_socket.html#ae7913ea4019cc2a10c9a0390c5959071" title="Close() closes the specified WebSocket connection by specifying code and reason.">Close()</a> is not finished. </dd></dl>
120 </div>
121 </div>
122 <a class="anchor" id="ad8471399bfca7df23b87ded733d53141"></a><!-- doxytag: member="pp::WebSocket::Connect" ref="ad8471399bfca7df23b87ded733d53141" args="(const Var &amp;url, const Var protocols[], uint32_t protocol_count, const CompletionCallback &amp;callback)" -->
123 <div class="memitem">
124 <div class="memproto">
125 <table class="memname">
126 <tr>
127 <td class="memname">int32_t <a class="el" href="classpp_1_1_web_socket.html#ad8471399bfca7df23b87ded733d53141">pp::WebSocket::Connect</a> </td>
128 <td>(</td>
129 <td class="paramtype">const <a class="el" href="classpp_1_1_var.html">Var</a> &amp;&#160;</td>
130 <td class="paramname"><em>url</em>, </td>
131 </tr>
132 <tr>
133 <td class="paramkey"></td>
134 <td></td>
135 <td class="paramtype">const <a class="el" href="classpp_1_1_var.html">Var</a>&#160;</td>
136 <td class="paramname"><em>protocols</em>[], </td>
137 </tr>
138 <tr>
139 <td class="paramkey"></td>
140 <td></td>
141 <td class="paramtype">uint32_t&#160;</td>
142 <td class="paramname"><em>protocol_count</em>, </td>
143 </tr>
144 <tr>
145 <td class="paramkey"></td>
146 <td></td>
147 <td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;&#160;</td>
148 <td class="paramname"><em>callback</em>&#160;</td>
149 </tr>
150 <tr>
151 <td></td>
152 <td>)</td>
153 <td></td><td></td>
154 </tr>
155 </table>
156 </div>
157 <div class="memdoc">
158 <p><a class="el" href="classpp_1_1_web_socket.html#ad8471399bfca7df23b87ded733d53141" title="Connect() connects to the specified WebSocket server.">Connect()</a> connects to the specified <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> server. </p>
159 <p>You can call this function once for an object.</p>
160 <dl class="params"><dt><b>Parameters:</b></dt><dd>
161 <table class="params">
162 <tr><td class="paramdir">[in]</td><td class="paramname">url</td><td>A <code><a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a></code> of string type representing a <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> server URL.</td></tr>
163 <tr><td class="paramdir">[in]</td><td class="paramname">protocols</td><td>A pointer to an array of <code><a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a></code> of string type specifying sub-protocols. Each <code><a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a></code> represents one sub-protocol. This argument can be null only if <code>protocol_count</code> is 0.</td></tr>
164 <tr><td class="paramdir">[in]</td><td class="paramname">protocol_count</td><td>The number of sub-protocols in <code>protocols</code>.</td></tr>
165 <tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="classpp_1_1_completion_callback.html" title="This API enables you to implement and receive callbacks when Pepper operations complete asynchronousl...">CompletionCallback</a></code> called when a connection is established or an error occurs in establishing connection.</td></tr>
166 </table>
167 </dd>
168 </dl>
169 <dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code>pp_errors.h</code>. Returns <code>PP_ERROR_BADARGUMENT</code> if specified <code>url</code>, or <code>protocols</code> contains invalid string as defined in the <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> API specification. <code>PP_ERROR_BADARGUMENT</code> corresponds to a SyntaxError in the <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> 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="classpp_1_1_web_socket.html#ad8471399bfca7df23b87ded733d53141" title="Connect() connects to the specified WebSocket server.">Connect()</a>. </dd></dl>
170 </div>
171 </div>
172 <a class="anchor" id="aee920e33ef266c51ffdaeba8d6924e19"></a><!-- doxytag: member="pp::WebSocket::GetBufferedAmount" ref="aee920e33ef266c51ffdaeba8d6924e19" args="()" -->
173 <div class="memitem">
174 <div class="memproto">
175 <table class="memname">
176 <tr>
177 <td class="memname">uint64_t <a class="el" href="classpp_1_1_web_socket.html#aee920e33ef266c51ffdaeba8d6924e19">pp::WebSocket::GetBufferedAmount</a> </td>
178 <td>(</td>
179 <td class="paramname"></td><td>)</td>
180 <td></td>
181 </tr>
182 </table>
183 </div>
184 <div class="memdoc">
185 <p><a class="el" href="classpp_1_1_web_socket.html#aee920e33ef266c51ffdaeba8d6924e19" 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 <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> connection to send, but have not been transmitted to the network yet. </p>
186 <dl class="return"><dt><b>Returns:</b></dt><dd>Returns the number of bytes. </dd></dl>
187 </div>
188 </div>
189 <a class="anchor" id="ab1bb565b7800fd3c147177e4e3a3466f"></a><!-- doxytag: member="pp::WebSocket::GetCloseCode" ref="ab1bb565b7800fd3c147177e4e3a3466f" args="()" -->
190 <div class="memitem">
191 <div class="memproto">
192 <table class="memname">
193 <tr>
194 <td class="memname">uint16_t <a class="el" href="classpp_1_1_web_socket.html#ab1bb565b7800fd3c147177e4e3a3466f">pp::WebSocket::GetCloseCode</a> </td>
195 <td>(</td>
196 <td class="paramname"></td><td>)</td>
197 <td></td>
198 </tr>
199 </table>
200 </div>
201 <div class="memdoc">
202 <p><a class="el" href="classpp_1_1_web_socket.html#ab1bb565b7800fd3c147177e4e3a3466f" title="GetCloseCode() returns the connection close code for the WebSocket connection.">GetCloseCode()</a> returns the connection close code for the <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> connection. </p>
203 <dl class="return"><dt><b>Returns:</b></dt><dd>Returns 0 if called before the close code is set. </dd></dl>
204 </div>
205 </div>
206 <a class="anchor" id="a27c9cf6d130706fcc5e6fe2f9ed51a7b"></a><!-- doxytag: member="pp::WebSocket::GetCloseReason" ref="a27c9cf6d130706fcc5e6fe2f9ed51a7b" args="()" -->
207 <div class="memitem">
208 <div class="memproto">
209 <table class="memname">
210 <tr>
211 <td class="memname"><a class="el" href="classpp_1_1_var.html">Var</a> <a class="el" href="classpp_1_1_web_socket.html#a27c9cf6d130706fcc5e6fe2f9ed51a7b">pp::WebSocket::GetCloseReason</a> </td>
212 <td>(</td>
213 <td class="paramname"></td><td>)</td>
214 <td></td>
215 </tr>
216 </table>
217 </div>
218 <div class="memdoc">
219 <p><a class="el" href="classpp_1_1_web_socket.html#a27c9cf6d130706fcc5e6fe2f9ed51a7b" title="GetCloseReason() returns the connection close reason for the WebSocket connection.">GetCloseReason()</a> returns the connection close reason for the <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> connection. </p>
220 <dl class="return"><dt><b>Returns:</b></dt><dd>Returns a <code><a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a></code> of string type. 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>
221 </div>
222 </div>
223 <a class="anchor" id="a092b63f716b3e02fc8ec0696ac58df84"></a><!-- doxytag: member="pp::WebSocket::GetCloseWasClean" ref="a092b63f716b3e02fc8ec0696ac58df84" args="()" -->
224 <div class="memitem">
225 <div class="memproto">
226 <table class="memname">
227 <tr>
228 <td class="memname">bool <a class="el" href="classpp_1_1_web_socket.html#a092b63f716b3e02fc8ec0696ac58df84">pp::WebSocket::GetCloseWasClean</a> </td>
229 <td>(</td>
230 <td class="paramname"></td><td>)</td>
231 <td></td>
232 </tr>
233 </table>
234 </div>
235 <div class="memdoc">
236 <p><a class="el" href="classpp_1_1_web_socket.html#a092b63f716b3e02fc8ec0696ac58df84" 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 <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> connection. </p>
237 <dl class="return"><dt><b>Returns:</b></dt><dd>Returns <code>false</code> if called before the connection is closed, called on an invalid resource, or closed for abnormal reasons. Otherwise, returns <code>true</code> if the connection was closed cleanly. </dd></dl>
238 </div>
239 </div>
240 <a class="anchor" id="ab22093b22b7ceea6957047e1cb5967d2"></a><!-- doxytag: member="pp::WebSocket::GetExtensions" ref="ab22093b22b7ceea6957047e1cb5967d2" args="()" -->
241 <div class="memitem">
242 <div class="memproto">
243 <table class="memname">
244 <tr>
245 <td class="memname"><a class="el" href="classpp_1_1_var.html">Var</a> <a class="el" href="classpp_1_1_web_socket.html#ab22093b22b7ceea6957047e1cb5967d2">pp::WebSocket::GetExtensions</a> </td>
246 <td>(</td>
247 <td class="paramname"></td><td>)</td>
248 <td></td>
249 </tr>
250 </table>
251 </div>
252 <div class="memdoc">
253 <p><a class="el" href="classpp_1_1_web_socket.html#ab22093b22b7ceea6957047e1cb5967d2" 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 <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> connection. </p>
254 <dl class="return"><dt><b>Returns:</b></dt><dd>Returns a <code><a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a></code> of string type. If called before the connection is established, the <code><a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a></code>'s data is an empty string. Returns a <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. Currently the <code><a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a></code>'s data for valid resources are always an empty string. </dd></dl>
255 </div>
256 </div>
257 <a class="anchor" id="a1c4b81bb05d30fdef67a07ac904abf0f"></a><!-- doxytag: member="pp::WebSocket::GetProtocol" ref="a1c4b81bb05d30fdef67a07ac904abf0f" args="()" -->
258 <div class="memitem">
259 <div class="memproto">
260 <table class="memname">
261 <tr>
262 <td class="memname"><a class="el" href="classpp_1_1_var.html">Var</a> <a class="el" href="classpp_1_1_web_socket.html#a1c4b81bb05d30fdef67a07ac904abf0f">pp::WebSocket::GetProtocol</a> </td>
263 <td>(</td>
264 <td class="paramname"></td><td>)</td>
265 <td></td>
266 </tr>
267 </table>
268 </div>
269 <div class="memdoc">
270 <p><a class="el" href="classpp_1_1_web_socket.html#a1c4b81bb05d30fdef67a07ac904abf0f" 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 <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> connection. </p>
271 <dl class="return"><dt><b>Returns:</b></dt><dd>Returns a <code><a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a></code> of string type. If called before the connection is established, the <code><a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a></code> contains the empty string. Returns a code&gt;PP_VARTYPE_UNDEFINED if called on an invalid resource. </dd></dl>
272 </div>
273 </div>
274 <a class="anchor" id="afa09ce5acb5f7f168f17b8b3f5939317"></a><!-- doxytag: member="pp::WebSocket::GetReadyState" ref="afa09ce5acb5f7f168f17b8b3f5939317" args="()" -->
275 <div class="memitem">
276 <div class="memproto">
277 <table class="memname">
278 <tr>
279 <td class="memname">PP_WebSocketReadyState <a class="el" href="classpp_1_1_web_socket.html#afa09ce5acb5f7f168f17b8b3f5939317">pp::WebSocket::GetReadyState</a> </td>
280 <td>(</td>
281 <td class="paramname"></td><td>)</td>
282 <td></td>
283 </tr>
284 </table>
285 </div>
286 <div class="memdoc">
287 <p><a class="el" href="classpp_1_1_web_socket.html#afa09ce5acb5f7f168f17b8b3f5939317" title="GetReadyState() returns the ready state of the specified WebSocket connection.">GetReadyState()</a> returns the ready state of the specified <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> connection. </p>
288 <dl class="return"><dt><b>Returns:</b></dt><dd>Returns <code>PP_WEBSOCKETREADYSTATE_INVALID</code> if called before <a class="el" href="classpp_1_1_web_socket.html#ad8471399bfca7df23b87ded733d53141" title="Connect() connects to the specified WebSocket server.">Connect()</a> is called, or if this function is called on an invalid resource. </dd></dl>
289 </div>
290 </div>
291 <a class="anchor" id="ab76ccebfe20facff03464e71f4af7719"></a><!-- doxytag: member="pp::WebSocket::GetURL" ref="ab76ccebfe20facff03464e71f4af7719" args="()" -->
292 <div class="memitem">
293 <div class="memproto">
294 <table class="memname">
295 <tr>
296 <td class="memname"><a class="el" href="classpp_1_1_var.html">Var</a> <a class="el" href="classpp_1_1_web_socket.html#ab76ccebfe20facff03464e71f4af7719">pp::WebSocket::GetURL</a> </td>
297 <td>(</td>
298 <td class="paramname"></td><td>)</td>
299 <td></td>
300 </tr>
301 </table>
302 </div>
303 <div class="memdoc">
304 <p><a class="el" href="classpp_1_1_web_socket.html#ab76ccebfe20facff03464e71f4af7719" title="GetURL() returns the URL associated with specified WebSocket connection.">GetURL()</a> returns the URL associated with specified <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> connection. </p>
305 <dl class="return"><dt><b>Returns:</b></dt><dd>Returns a <code><a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a></code> of string type. If called before the connection is established, the <code><a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a></code> contains the empty string. Returns a <code>PP_VARTYPE_UNDEFINED</code> if this function is called on an invalid resource. </dd></dl>
306 </div>
307 </div>
308 <a class="anchor" id="a1eb972115700589ebf6998db4f411c56"></a><!-- doxytag: member="pp::WebSocket::ReceiveMessage" ref="a1eb972115700589ebf6998db4f411c56" args="(Var *message, const CompletionCallback &amp;callback)" -->
309 <div class="memitem">
310 <div class="memproto">
311 <table class="memname">
312 <tr>
313 <td class="memname">int32_t <a class="el" href="classpp_1_1_web_socket.html#a1eb972115700589ebf6998db4f411c56">pp::WebSocket::ReceiveMessage</a> </td>
314 <td>(</td>
315 <td class="paramtype"><a class="el" href="classpp_1_1_var.html">Var</a> *&#160;</td>
316 <td class="paramname"><em>message</em>, </td>
317 </tr>
318 <tr>
319 <td class="paramkey"></td>
320 <td></td>
321 <td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;&#160;</td>
322 <td class="paramname"><em>callback</em>&#160;</td>
323 </tr>
324 <tr>
325 <td></td>
326 <td>)</td>
327 <td></td><td></td>
328 </tr>
329 </table>
330 </div>
331 <div class="memdoc">
332 <p><a class="el" href="classpp_1_1_web_socket.html#a1eb972115700589ebf6998db4f411c56" title="ReceiveMessage() receives a message from the WebSocket server.">ReceiveMessage()</a> receives a message from the <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> server. </p>
333 <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>
334 <dl class="params"><dt><b>Parameters:</b></dt><dd>
335 <table class="params">
336 <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="classpp_1_1_web_socket.html#a1eb972115700589ebf6998db4f411c56" title="ReceiveMessage() receives a message from the WebSocket server.">ReceiveMessage()</a> completes. Its received <code><a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a></code> will be of string or ArrayBuffer type.</td></tr>
337 <tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="classpp_1_1_completion_callback.html" title="This API enables you to implement and receive callbacks when Pepper operations complete asynchronousl...">CompletionCallback</a></code> called when <a class="el" href="classpp_1_1_web_socket.html#a1eb972115700589ebf6998db4f411c56" title="ReceiveMessage() receives a message from the WebSocket server.">ReceiveMessage()</a> completes. This callback is ignored if <a class="el" href="classpp_1_1_web_socket.html#a1eb972115700589ebf6998db4f411c56" title="ReceiveMessage() receives a message from the WebSocket server.">ReceiveMessage()</a> completes synchronously and returns <code>PP_OK</code>.</td></tr>
338 </table>
339 </dd>
340 </dl>
341 <dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code>pp_errors.h</code>. If an error is detected or connection is closed, <a class="el" href="classpp_1_1_web_socket.html#a1eb972115700589ebf6998db4f411c56" 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="classpp_1_1_web_socket.html#a1eb972115700589ebf6998db4f411c56" 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>
342 </div>
343 </div>
344 <a class="anchor" id="a276b1aae76ba9d899475aaf9c2cd4f28"></a><!-- doxytag: member="pp::WebSocket::SendMessage" ref="a276b1aae76ba9d899475aaf9c2cd4f28" args="(const Var &amp;message)" -->
345 <div class="memitem">
346 <div class="memproto">
347 <table class="memname">
348 <tr>
349 <td class="memname">int32_t <a class="el" href="classpp_1_1_web_socket.html#a276b1aae76ba9d899475aaf9c2cd4f28">pp::WebSocket::SendMessage</a> </td>
350 <td>(</td>
351 <td class="paramtype">const <a class="el" href="classpp_1_1_var.html">Var</a> &amp;&#160;</td>
352 <td class="paramname"><em>message</em></td><td>)</td>
353 <td></td>
354 </tr>
355 </table>
356 </div>
357 <div class="memdoc">
358 <p><a class="el" href="classpp_1_1_web_socket.html#a276b1aae76ba9d899475aaf9c2cd4f28" title="SendMessage() sends a message to the WebSocket server.">SendMessage()</a> sends a message to the <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> server. </p>
359 <dl class="params"><dt><b>Parameters:</b></dt><dd>
360 <table class="params">
361 <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. This <code><a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a></code> must be of string or ArrayBuffer types.</td></tr>
362 </table>
363 </dd>
364 </dl>
365 <dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code>pp_errors.h</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 <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> 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 <a class="el" href="classpp_1_1_web_socket.html" title="The WebSocket class providing bi-directional, full-duplex, communications over a single TCP socket...">WebSocket</a> API specification. Otherwise, returns <code>PP_OK</code>, but it doesn't necessarily mean that the server received the message. </dd></dl>
366 </div>
367 </div>
368 <hr />The documentation for this class was generated from the following file:<ul>
369 <li><a class="el" href="websocket_8h.html">websocket.h</a></li>
370 </ul>
371 </div><!-- contents -->
372 {{/partials.standard_nacl_article}}