web_sys/features/
gen_WebSocket.rs

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