1 | import { IFrame } from './i-frame';
|
2 | import { IMessage } from './i-message';
|
3 | import { StompHeaders } from './stomp-headers';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | export type debugFnType = (msg: string) => void;
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | export type messageCallbackType = (message: IMessage) => void;
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | export type frameCallbackType = (receipt: IFrame) => void;
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 | export type closeEventCallbackType<T = any> = (evt: T) => void;
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | export type wsErrorCallbackType<T = any> = (evt: T) => void;
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | export interface IPublishParams {
|
49 | |
50 |
|
51 |
|
52 | destination: string;
|
53 | |
54 |
|
55 |
|
56 | headers?: StompHeaders;
|
57 | |
58 |
|
59 |
|
60 | body?: string;
|
61 | |
62 |
|
63 |
|
64 | binaryBody?: Uint8Array;
|
65 | |
66 |
|
67 |
|
68 |
|
69 | skipContentLengthHeader?: boolean;
|
70 | }
|
71 |
|
72 |
|
73 |
|
74 |
|
75 | export type publishParams = IPublishParams;
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 | export type RawHeaderType = [string, string];
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 | export interface IRawFrameType {
|
94 | command: string;
|
95 | headers: RawHeaderType[];
|
96 | binaryBody: Uint8Array;
|
97 | }
|
98 |
|
99 |
|
100 |
|
101 |
|
102 | export interface IStompSocketMessageEvent {
|
103 | data?: string | ArrayBuffer;
|
104 | }
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | export interface IStompSocket {
|
112 | onclose: ((this: IStompSocket, ev?: any) => any) | null;
|
113 | onerror: ((this: IStompSocket, ev: any) => any) | null;
|
114 | onmessage: ((this: IStompSocket, ev: IStompSocketMessageEvent) => any) | null;
|
115 | onopen: ((this: IStompSocket, ev?: any) => any) | null;
|
116 | terminate?: ((this: IStompSocket) => any) | null;
|
117 |
|
118 | /**
|
119 | * Returns a string that indicates how binary data from the socket is exposed to scripts:
|
120 | * We support only 'arraybuffer'.
|
121 | */
|
122 | binaryType: 'arraybuffer';
|
123 |
|
124 | /**
|
125 | * Returns the state of the socket connection. It can have the values of StompSocketState.
|
126 | */
|
127 | readonly readyState: number;
|
128 |
|
129 | /**
|
130 | * Closes the connection.
|
131 | */
|
132 | close(): void;
|
133 | /**
|
134 | * Transmits data using the connection. data can be a string or an ArrayBuffer.
|
135 | */
|
136 | send(data: string | ArrayBuffer): void;
|
137 | }
|
138 |
|
139 | /**
|
140 | * Possible states for the IStompSocket
|
141 | */
|
142 | export enum StompSocketState {
|
143 | CONNECTING,
|
144 | OPEN,
|
145 | CLOSING,
|
146 | CLOSED,
|
147 | }
|
148 |
|
149 | /**
|
150 | * Possible activation state
|
151 | */
|
152 | export enum ActivationState {
|
153 | ACTIVE,
|
154 | DEACTIVATING,
|
155 | INACTIVE,
|
156 | }
|
157 |
|
\ | No newline at end of file |