Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / native_client_sdk / doc_generated / pepper_beta / cpp / classpp_1_1_web_socket.html
1 {{+bindTo:partials.standard_nacl_api}}
2 <h1>pp::WebSocket Class 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
10 </div>
11 <!--header-->
12 <div class="contents">
13 <!-- doxytag: class="pp::WebSocket" --><!-- doxytag: inherits="pp::Resource" --><div class="dynheader">
14 Inheritance diagram for pp::WebSocket:</div>
15 <div class="dyncontent">
16 <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>
17 <map name="pp_1_1_web_socket_inherit__map" id="pp_1_1_web_socket_inherit__map">
18 <area shape="rect" id="node2" href="classpp_1_1_resource.html" title="A reference counted module resource." alt="" coords="11,5,115,32"></area></map>
19 <center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
20 <p><a href="classpp_1_1_web_socket-members.html">List of all members.</a></p>
21 <h2>
22 Public Member Functions</h2><table class="memberdecls">
23
24 <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>
25 <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>
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#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>
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#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>
28 <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>
29 <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>
30 <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>
31 <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>
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#a27c9cf6d130706fcc5e6fe2f9ed51a7b">GetCloseReason</a> ()</td></tr>
33 <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>
34 <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>
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#a1c4b81bb05d30fdef67a07ac904abf0f">GetProtocol</a> ()</td></tr>
36 <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>
37 <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>
38 </table>
39 <hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
40 <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>
41 </div><hr /><h2>Constructor &amp; Destructor Documentation</h2>
42 <a class="anchor" id="aeaac3a412a9015a9378beec9f42d5809"></a><!-- doxytag: member="pp::WebSocket::WebSocket" ref="aeaac3a412a9015a9378beec9f42d5809" args="(const InstanceHandle &amp;instance)" -->
43 <div class="memitem">
44 <div class="memproto">
45 <table class="memname">
46 <tr>
47 <td class="memname"><a class="el" href="classpp_1_1_web_socket.html#aeaac3a412a9015a9378beec9f42d5809">pp::WebSocket::WebSocket</a> </td>
48 <td>(</td>
49 <td class="paramtype">const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> &amp;&#160;</td>
50 <td class="paramname"><em>instance</em></td><td>)</td>
51 <td><code> [explicit]</code></td>
52 </tr>
53 </table>
54 </div>
55 <div class="memdoc">
56 <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>
57 <dl class="params"><dt><b>Parameters:</b></dt><dd>
58 <table class="params">
59 <tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>The instance with which this resource will be associated. </td></tr>
60 </table>
61 </dd>
62 </dl>
63 </div>
64 </div>
65 <a class="anchor" id="aa4810e4b945c1fc92493dc206eb35c09"></a><!-- doxytag: member="pp::WebSocket::~WebSocket" ref="aa4810e4b945c1fc92493dc206eb35c09" args="()" -->
66 <div class="memitem">
67 <div class="memproto">
68 <table class="memname">
69 <tr>
70 <td class="memname">virtual <a class="el" href="classpp_1_1_web_socket.html#aa4810e4b945c1fc92493dc206eb35c09">pp::WebSocket::~WebSocket</a> </td>
71 <td>(</td>
72 <td class="paramname"></td><td>)</td>
73 <td><code> [virtual]</code></td>
74 </tr>
75 </table>
76 </div>
77 <div class="memdoc">
78 <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>
79 </div>
80 </div>
81 <hr /><h2>Member Function Documentation</h2>
82 <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)" -->
83 <div class="memitem">
84 <div class="memproto">
85 <table class="memname">
86 <tr>
87 <td class="memname">int32_t <a class="el" href="classpp_1_1_web_socket.html#ae7913ea4019cc2a10c9a0390c5959071">pp::WebSocket::Close</a> </td>
88 <td>(</td>
89 <td class="paramtype">uint16_t&#160;</td>
90 <td class="paramname"><em>code</em>, </td>
91 </tr>
92 <tr>
93 <td class="paramkey"></td>
94 <td></td>
95 <td class="paramtype">const <a class="el" href="classpp_1_1_var.html">Var</a> &amp;&#160;</td>
96 <td class="paramname"><em>reason</em>, </td>
97 </tr>
98 <tr>
99 <td class="paramkey"></td>
100 <td></td>
101 <td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;&#160;</td>
102 <td class="paramname"><em>callback</em>&#160;</td>
103 </tr>
104 <tr>
105 <td></td>
106 <td>)</td>
107 <td></td><td></td>
108 </tr>
109 </table>
110 </div>
111 <div class="memdoc">
112 <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>
113 <dl class="params"><dt><b>Parameters:</b></dt><dd>
114 <table class="params">
115 <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>
116 <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>
117 <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>
118 </table>
119 </dd>
120 </dl>
121 <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>
122 </div>
123 </div>
124 <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)" -->
125 <div class="memitem">
126 <div class="memproto">
127 <table class="memname">
128 <tr>
129 <td class="memname">int32_t <a class="el" href="classpp_1_1_web_socket.html#ad8471399bfca7df23b87ded733d53141">pp::WebSocket::Connect</a> </td>
130 <td>(</td>
131 <td class="paramtype">const <a class="el" href="classpp_1_1_var.html">Var</a> &amp;&#160;</td>
132 <td class="paramname"><em>url</em>, </td>
133 </tr>
134 <tr>
135 <td class="paramkey"></td>
136 <td></td>
137 <td class="paramtype">const <a class="el" href="classpp_1_1_var.html">Var</a>&#160;</td>
138 <td class="paramname"><em>protocols</em>[], </td>
139 </tr>
140 <tr>
141 <td class="paramkey"></td>
142 <td></td>
143 <td class="paramtype">uint32_t&#160;</td>
144 <td class="paramname"><em>protocol_count</em>, </td>
145 </tr>
146 <tr>
147 <td class="paramkey"></td>
148 <td></td>
149 <td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;&#160;</td>
150 <td class="paramname"><em>callback</em>&#160;</td>
151 </tr>
152 <tr>
153 <td></td>
154 <td>)</td>
155 <td></td><td></td>
156 </tr>
157 </table>
158 </div>
159 <div class="memdoc">
160 <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>
161 <p>You can call this function once for an object.</p>
162 <dl class="params"><dt><b>Parameters:</b></dt><dd>
163 <table class="params">
164 <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>
165 <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>
166 <tr><td class="paramdir">[in]</td><td class="paramname">protocol_count</td><td>The number of sub-protocols in <code>protocols</code>.</td></tr>
167 <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>
168 </table>
169 </dd>
170 </dl>
171 <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>
172 </div>
173 </div>
174 <a class="anchor" id="aee920e33ef266c51ffdaeba8d6924e19"></a><!-- doxytag: member="pp::WebSocket::GetBufferedAmount" ref="aee920e33ef266c51ffdaeba8d6924e19" args="()" -->
175 <div class="memitem">
176 <div class="memproto">
177 <table class="memname">
178 <tr>
179 <td class="memname">uint64_t <a class="el" href="classpp_1_1_web_socket.html#aee920e33ef266c51ffdaeba8d6924e19">pp::WebSocket::GetBufferedAmount</a> </td>
180 <td>(</td>
181 <td class="paramname"></td><td>)</td>
182 <td></td>
183 </tr>
184 </table>
185 </div>
186 <div class="memdoc">
187 <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>
188 <dl class="return"><dt><b>Returns:</b></dt><dd>Returns the number of bytes. </dd></dl>
189 </div>
190 </div>
191 <a class="anchor" id="ab1bb565b7800fd3c147177e4e3a3466f"></a><!-- doxytag: member="pp::WebSocket::GetCloseCode" ref="ab1bb565b7800fd3c147177e4e3a3466f" args="()" -->
192 <div class="memitem">
193 <div class="memproto">
194 <table class="memname">
195 <tr>
196 <td class="memname">uint16_t <a class="el" href="classpp_1_1_web_socket.html#ab1bb565b7800fd3c147177e4e3a3466f">pp::WebSocket::GetCloseCode</a> </td>
197 <td>(</td>
198 <td class="paramname"></td><td>)</td>
199 <td></td>
200 </tr>
201 </table>
202 </div>
203 <div class="memdoc">
204 <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>
205 <dl class="return"><dt><b>Returns:</b></dt><dd>Returns 0 if called before the close code is set. </dd></dl>
206 </div>
207 </div>
208 <a class="anchor" id="a27c9cf6d130706fcc5e6fe2f9ed51a7b"></a><!-- doxytag: member="pp::WebSocket::GetCloseReason" ref="a27c9cf6d130706fcc5e6fe2f9ed51a7b" args="()" -->
209 <div class="memitem">
210 <div class="memproto">
211 <table class="memname">
212 <tr>
213 <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>
214 <td>(</td>
215 <td class="paramname"></td><td>)</td>
216 <td></td>
217 </tr>
218 </table>
219 </div>
220 <div class="memdoc">
221 <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>
222 <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>
223 </div>
224 </div>
225 <a class="anchor" id="a092b63f716b3e02fc8ec0696ac58df84"></a><!-- doxytag: member="pp::WebSocket::GetCloseWasClean" ref="a092b63f716b3e02fc8ec0696ac58df84" args="()" -->
226 <div class="memitem">
227 <div class="memproto">
228 <table class="memname">
229 <tr>
230 <td class="memname">bool <a class="el" href="classpp_1_1_web_socket.html#a092b63f716b3e02fc8ec0696ac58df84">pp::WebSocket::GetCloseWasClean</a> </td>
231 <td>(</td>
232 <td class="paramname"></td><td>)</td>
233 <td></td>
234 </tr>
235 </table>
236 </div>
237 <div class="memdoc">
238 <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>
239 <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>
240 </div>
241 </div>
242 <a class="anchor" id="ab22093b22b7ceea6957047e1cb5967d2"></a><!-- doxytag: member="pp::WebSocket::GetExtensions" ref="ab22093b22b7ceea6957047e1cb5967d2" args="()" -->
243 <div class="memitem">
244 <div class="memproto">
245 <table class="memname">
246 <tr>
247 <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>
248 <td>(</td>
249 <td class="paramname"></td><td>)</td>
250 <td></td>
251 </tr>
252 </table>
253 </div>
254 <div class="memdoc">
255 <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>
256 <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>
257 </div>
258 </div>
259 <a class="anchor" id="a1c4b81bb05d30fdef67a07ac904abf0f"></a><!-- doxytag: member="pp::WebSocket::GetProtocol" ref="a1c4b81bb05d30fdef67a07ac904abf0f" args="()" -->
260 <div class="memitem">
261 <div class="memproto">
262 <table class="memname">
263 <tr>
264 <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>
265 <td>(</td>
266 <td class="paramname"></td><td>)</td>
267 <td></td>
268 </tr>
269 </table>
270 </div>
271 <div class="memdoc">
272 <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>
273 <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>
274 </div>
275 </div>
276 <a class="anchor" id="afa09ce5acb5f7f168f17b8b3f5939317"></a><!-- doxytag: member="pp::WebSocket::GetReadyState" ref="afa09ce5acb5f7f168f17b8b3f5939317" args="()" -->
277 <div class="memitem">
278 <div class="memproto">
279 <table class="memname">
280 <tr>
281 <td class="memname">PP_WebSocketReadyState <a class="el" href="classpp_1_1_web_socket.html#afa09ce5acb5f7f168f17b8b3f5939317">pp::WebSocket::GetReadyState</a> </td>
282 <td>(</td>
283 <td class="paramname"></td><td>)</td>
284 <td></td>
285 </tr>
286 </table>
287 </div>
288 <div class="memdoc">
289 <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>
290 <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>
291 </div>
292 </div>
293 <a class="anchor" id="ab76ccebfe20facff03464e71f4af7719"></a><!-- doxytag: member="pp::WebSocket::GetURL" ref="ab76ccebfe20facff03464e71f4af7719" args="()" -->
294 <div class="memitem">
295 <div class="memproto">
296 <table class="memname">
297 <tr>
298 <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>
299 <td>(</td>
300 <td class="paramname"></td><td>)</td>
301 <td></td>
302 </tr>
303 </table>
304 </div>
305 <div class="memdoc">
306 <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>
307 <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>
308 </div>
309 </div>
310 <a class="anchor" id="a1eb972115700589ebf6998db4f411c56"></a><!-- doxytag: member="pp::WebSocket::ReceiveMessage" ref="a1eb972115700589ebf6998db4f411c56" args="(Var *message, const CompletionCallback &amp;callback)" -->
311 <div class="memitem">
312 <div class="memproto">
313 <table class="memname">
314 <tr>
315 <td class="memname">int32_t <a class="el" href="classpp_1_1_web_socket.html#a1eb972115700589ebf6998db4f411c56">pp::WebSocket::ReceiveMessage</a> </td>
316 <td>(</td>
317 <td class="paramtype"><a class="el" href="classpp_1_1_var.html">Var</a> *&#160;</td>
318 <td class="paramname"><em>message</em>, </td>
319 </tr>
320 <tr>
321 <td class="paramkey"></td>
322 <td></td>
323 <td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;&#160;</td>
324 <td class="paramname"><em>callback</em>&#160;</td>
325 </tr>
326 <tr>
327 <td></td>
328 <td>)</td>
329 <td></td><td></td>
330 </tr>
331 </table>
332 </div>
333 <div class="memdoc">
334 <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>
335 <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>
336 <dl class="params"><dt><b>Parameters:</b></dt><dd>
337 <table class="params">
338 <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>
339 <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>
340 </table>
341 </dd>
342 </dl>
343 <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>
344 </div>
345 </div>
346 <a class="anchor" id="a276b1aae76ba9d899475aaf9c2cd4f28"></a><!-- doxytag: member="pp::WebSocket::SendMessage" ref="a276b1aae76ba9d899475aaf9c2cd4f28" args="(const Var &amp;message)" -->
347 <div class="memitem">
348 <div class="memproto">
349 <table class="memname">
350 <tr>
351 <td class="memname">int32_t <a class="el" href="classpp_1_1_web_socket.html#a276b1aae76ba9d899475aaf9c2cd4f28">pp::WebSocket::SendMessage</a> </td>
352 <td>(</td>
353 <td class="paramtype">const <a class="el" href="classpp_1_1_var.html">Var</a> &amp;&#160;</td>
354 <td class="paramname"><em>message</em></td><td>)</td>
355 <td></td>
356 </tr>
357 </table>
358 </div>
359 <div class="memdoc">
360 <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>
361 <dl class="params"><dt><b>Parameters:</b></dt><dd>
362 <table class="params">
363 <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>
364 </table>
365 </dd>
366 </dl>
367 <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>
368 </div>
369 </div>
370 <hr />The documentation for this class was generated from the following file:<ul>
371 <li><a class="el" href="websocket_8h.html">websocket.h</a></li>
372 </ul>
373 </div><!-- contents -->
374 </div>
375 {{/partials.standard_nacl_api}}