1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7 #[wasm_bindgen(
8 extends = "EventTarget",
9 extends = "::js_sys::Object",
10 js_name = "TCPSocket",
11 typescript_type = "TCPSocket"
12 )]
13 #[derive(Debug, Clone, PartialEq, Eq)]
14 #[doc = "The `TcpSocket` class."]
15 #[doc = ""]
16 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket)"]
17 #[doc = ""]
18 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
19 pub type TcpSocket;
20 #[wasm_bindgen(method, getter, js_class = "TCPSocket", js_name = "host")]
21 #[doc = "Getter for the `host` field of this object."]
22 #[doc = ""]
23 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/host)"]
24 #[doc = ""]
25 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
26 pub fn host(this: &TcpSocket) -> ::alloc::string::String;
27 #[wasm_bindgen(method, getter, js_class = "TCPSocket", js_name = "port")]
28 #[doc = "Getter for the `port` field of this object."]
29 #[doc = ""]
30 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/port)"]
31 #[doc = ""]
32 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
33 pub fn port(this: &TcpSocket) -> u16;
34 #[wasm_bindgen(method, getter, js_class = "TCPSocket", js_name = "ssl")]
35 #[doc = "Getter for the `ssl` field of this object."]
36 #[doc = ""]
37 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/ssl)"]
38 #[doc = ""]
39 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
40 pub fn ssl(this: &TcpSocket) -> bool;
41 #[wasm_bindgen(method, getter, js_class = "TCPSocket", js_name = "bufferedAmount")]
42 #[doc = "Getter for the `bufferedAmount` field of this object."]
43 #[doc = ""]
44 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/bufferedAmount)"]
45 #[doc = ""]
46 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
47 pub fn buffered_amount(this: &TcpSocket) -> f64;
48 #[cfg(feature = "TcpReadyState")]
49 #[wasm_bindgen(method, getter, js_class = "TCPSocket", js_name = "readyState")]
50 #[doc = "Getter for the `readyState` field of this object."]
51 #[doc = ""]
52 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/readyState)"]
53 #[doc = ""]
54 #[doc = "*This API requires the following crate features to be activated: `TcpReadyState`, `TcpSocket`*"]
55 pub fn ready_state(this: &TcpSocket) -> TcpReadyState;
56 #[cfg(feature = "TcpSocketBinaryType")]
57 #[wasm_bindgen(method, getter, js_class = "TCPSocket", js_name = "binaryType")]
58 #[doc = "Getter for the `binaryType` field of this object."]
59 #[doc = ""]
60 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/binaryType)"]
61 #[doc = ""]
62 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`, `TcpSocketBinaryType`*"]
63 pub fn binary_type(this: &TcpSocket) -> TcpSocketBinaryType;
64 #[wasm_bindgen(method, getter, js_class = "TCPSocket", js_name = "onopen")]
65 #[doc = "Getter for the `onopen` field of this object."]
66 #[doc = ""]
67 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/onopen)"]
68 #[doc = ""]
69 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
70 pub fn onopen(this: &TcpSocket) -> Option<::js_sys::Function>;
71 #[wasm_bindgen(method, setter, js_class = "TCPSocket", js_name = "onopen")]
72 #[doc = "Setter for the `onopen` field of this object."]
73 #[doc = ""]
74 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/onopen)"]
75 #[doc = ""]
76 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
77 pub fn set_onopen(this: &TcpSocket, value: Option<&::js_sys::Function>);
78 #[wasm_bindgen(method, getter, js_class = "TCPSocket", js_name = "ondrain")]
79 #[doc = "Getter for the `ondrain` field of this object."]
80 #[doc = ""]
81 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/ondrain)"]
82 #[doc = ""]
83 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
84 pub fn ondrain(this: &TcpSocket) -> Option<::js_sys::Function>;
85 #[wasm_bindgen(method, setter, js_class = "TCPSocket", js_name = "ondrain")]
86 #[doc = "Setter for the `ondrain` field of this object."]
87 #[doc = ""]
88 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/ondrain)"]
89 #[doc = ""]
90 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
91 pub fn set_ondrain(this: &TcpSocket, value: Option<&::js_sys::Function>);
92 #[wasm_bindgen(method, getter, js_class = "TCPSocket", js_name = "ondata")]
93 #[doc = "Getter for the `ondata` field of this object."]
94 #[doc = ""]
95 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/ondata)"]
96 #[doc = ""]
97 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
98 pub fn ondata(this: &TcpSocket) -> Option<::js_sys::Function>;
99 #[wasm_bindgen(method, setter, js_class = "TCPSocket", js_name = "ondata")]
100 #[doc = "Setter for the `ondata` field of this object."]
101 #[doc = ""]
102 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/ondata)"]
103 #[doc = ""]
104 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
105 pub fn set_ondata(this: &TcpSocket, value: Option<&::js_sys::Function>);
106 #[wasm_bindgen(method, getter, js_class = "TCPSocket", js_name = "onerror")]
107 #[doc = "Getter for the `onerror` field of this object."]
108 #[doc = ""]
109 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/onerror)"]
110 #[doc = ""]
111 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
112 pub fn onerror(this: &TcpSocket) -> Option<::js_sys::Function>;
113 #[wasm_bindgen(method, setter, js_class = "TCPSocket", js_name = "onerror")]
114 #[doc = "Setter for the `onerror` field of this object."]
115 #[doc = ""]
116 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/onerror)"]
117 #[doc = ""]
118 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
119 pub fn set_onerror(this: &TcpSocket, value: Option<&::js_sys::Function>);
120 #[wasm_bindgen(method, getter, js_class = "TCPSocket", js_name = "onclose")]
121 #[doc = "Getter for the `onclose` field of this object."]
122 #[doc = ""]
123 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/onclose)"]
124 #[doc = ""]
125 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
126 pub fn onclose(this: &TcpSocket) -> Option<::js_sys::Function>;
127 #[wasm_bindgen(method, setter, js_class = "TCPSocket", js_name = "onclose")]
128 #[doc = "Setter for the `onclose` field of this object."]
129 #[doc = ""]
130 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/onclose)"]
131 #[doc = ""]
132 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
133 pub fn set_onclose(this: &TcpSocket, value: Option<&::js_sys::Function>);
134 #[wasm_bindgen(catch, constructor, js_class = "TCPSocket")]
135 #[doc = "The `new TcpSocket(..)` constructor, creating a new instance of `TcpSocket`."]
136 #[doc = ""]
137 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/TCPSocket)"]
138 #[doc = ""]
139 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
140 pub fn new(host: &str, port: u16) -> Result<TcpSocket, JsValue>;
141 #[cfg(feature = "SocketOptions")]
142 #[wasm_bindgen(catch, constructor, js_class = "TCPSocket")]
143 #[doc = "The `new TcpSocket(..)` constructor, creating a new instance of `TcpSocket`."]
144 #[doc = ""]
145 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/TCPSocket)"]
146 #[doc = ""]
147 #[doc = "*This API requires the following crate features to be activated: `SocketOptions`, `TcpSocket`*"]
148 pub fn new_with_options(
149 host: &str,
150 port: u16,
151 options: &SocketOptions,
152 ) -> Result<TcpSocket, JsValue>;
153 #[wasm_bindgen(method, js_class = "TCPSocket")]
154 #[doc = "The `close()` method."]
155 #[doc = ""]
156 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/close)"]
157 #[doc = ""]
158 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
159 pub fn close(this: &TcpSocket);
160 #[wasm_bindgen(catch, method, js_class = "TCPSocket")]
161 #[doc = "The `resume()` method."]
162 #[doc = ""]
163 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/resume)"]
164 #[doc = ""]
165 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
166 pub fn resume(this: &TcpSocket) -> Result<(), JsValue>;
167 #[wasm_bindgen(catch, method, js_class = "TCPSocket", js_name = "send")]
168 #[doc = "The `send()` method."]
169 #[doc = ""]
170 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/send)"]
171 #[doc = ""]
172 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
173 pub fn send_with_str(this: &TcpSocket, data: &str) -> Result<bool, JsValue>;
174 #[wasm_bindgen(catch, method, js_class = "TCPSocket", js_name = "send")]
175 #[doc = "The `send()` method."]
176 #[doc = ""]
177 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/send)"]
178 #[doc = ""]
179 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
180 pub fn send_with_array_buffer(
181 this: &TcpSocket,
182 data: &::js_sys::ArrayBuffer,
183 ) -> Result<bool, JsValue>;
184 #[wasm_bindgen(catch, method, js_class = "TCPSocket", js_name = "send")]
185 #[doc = "The `send()` method."]
186 #[doc = ""]
187 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/send)"]
188 #[doc = ""]
189 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
190 pub fn send_with_array_buffer_and_byte_offset(
191 this: &TcpSocket,
192 data: &::js_sys::ArrayBuffer,
193 byte_offset: u32,
194 ) -> Result<bool, JsValue>;
195 #[wasm_bindgen(catch, method, js_class = "TCPSocket", js_name = "send")]
196 #[doc = "The `send()` method."]
197 #[doc = ""]
198 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/send)"]
199 #[doc = ""]
200 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
201 pub fn send_with_array_buffer_and_byte_offset_and_byte_length(
202 this: &TcpSocket,
203 data: &::js_sys::ArrayBuffer,
204 byte_offset: u32,
205 byte_length: u32,
206 ) -> Result<bool, JsValue>;
207 #[wasm_bindgen(method, js_class = "TCPSocket")]
208 #[doc = "The `suspend()` method."]
209 #[doc = ""]
210 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/suspend)"]
211 #[doc = ""]
212 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
213 pub fn suspend(this: &TcpSocket);
214 #[wasm_bindgen(catch, method, js_class = "TCPSocket", js_name = "upgradeToSecure")]
215 #[doc = "The `upgradeToSecure()` method."]
216 #[doc = ""]
217 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/upgradeToSecure)"]
218 #[doc = ""]
219 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
220 pub fn upgrade_to_secure(this: &TcpSocket) -> Result<(), JsValue>;
221}