1+ /**
2+ * The WebSocket open event.
3+ *
4+ * @property type - Always "open".
5+ * @property id - The unique identifier for the WebSocket connection.
6+ * @property origin - The origin of the WebSocket connection.
7+ */
18export type WebSocketOpenEvent = {
29 type : 'open' ;
310 id : string ;
411 origin : string ;
512} ;
613
14+ /**
15+ * The WebSocket close event.
16+ *
17+ * @property type - Always "close".
18+ * @property id - The unique identifier for the WebSocket connection.
19+ * @property origin - The origin of the WebSocket connection.
20+ * @property code - The close code sent by the WebSocket server.
21+ * @property reason - The string indicating the reason for the connection being closed.
22+ * @property wasClean - A boolean value that indicates whether the connection was closed without errors.
23+ */
724export type WebSocketCloseEvent = {
825 type : 'close' ;
926 id : string ;
@@ -13,10 +30,23 @@ export type WebSocketCloseEvent = {
1330 wasClean : boolean ;
1431} ;
1532
33+ /**
34+ * The WebSocket text message data.
35+ *
36+ * @property type - Always "text".
37+ * @property message - A string containing the message.
38+ */
1639export type WebSocketTextMessage = {
1740 type : 'text' ;
1841 message : string ;
1942} ;
43+
44+ /**
45+ * The WebSocket binary message data.
46+ *
47+ * @property type - Always "binary".
48+ * @property message - An array of bytes containing the message.
49+ */
2050export type WebSocketBinaryMessage = {
2151 type : 'binary' ;
2252 message : number [ ] ;
@@ -26,6 +56,14 @@ export type WebSocketMessageData =
2656 | WebSocketTextMessage
2757 | WebSocketBinaryMessage ;
2858
59+ /**
60+ * The WebSocket message event.
61+ *
62+ * @property type - Always "message".
63+ * @property id - The unique identifier for the WebSocket connection.
64+ * @property origin - The origin of the WebSocket connection.
65+ * @property data - The message data.
66+ */
2967export type WebSocketMessage = {
3068 type : 'message' ;
3169 id : string ;
0 commit comments