Skip to content

Commit d2f53d5

Browse files
More JSDoc
1 parent 45d2ea3 commit d2f53d5

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

packages/snaps-sdk/src/types/handlers/web-socket-event.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
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+
*/
18
export 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+
*/
724
export 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+
*/
1639
export 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+
*/
2050
export 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+
*/
2967
export type WebSocketMessage = {
3068
type: 'message';
3169
id: string;

0 commit comments

Comments
 (0)