-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathWebSocket.res
More file actions
56 lines (47 loc) · 1.99 KB
/
Copy pathWebSocket.res
File metadata and controls
56 lines (47 loc) · 1.99 KB
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
module Types = WebSocketsTypes
type t = Types.webSocket = {...Types.webSocket}
type binaryType = Types.binaryType
type messageEvent<'t> = Types.messageEvent<'t> = {...Types.messageEvent<'t>}
type closeEvent = Types.closeEvent = {...Types.closeEvent}
type messageEventSource = Types.messageEventSource
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebSocket)
*/
@new
external make: (~url: string, ~protocols: string=?) => t = "WebSocket"
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebSocket)
*/
@new
external makeWithProtocols: (~url: string, ~protocols: array<string>=?) => t = "WebSocket"
include EventTarget.Impl({type t = t})
/**
Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
*/
@send
external close: (t, ~code: int=?, ~reason: string=?) => unit = "close"
/**
Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
*/
@send
external send: (t, DataView.t) => unit = "send"
/**
Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
*/
@send
external sendArrayBuffer: (t, ArrayBuffer.t) => unit = "send"
/**
Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
*/
@send
external sendBlob: (t, Blob.t) => unit = "send"
/**
Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
*/
@send
external sendString: (t, string) => unit = "send"