forked from stomp-js/stomp-websocket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
70 lines (54 loc) · 2.19 KB
/
index.d.ts
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
// Type definitions for stompjs 2.3
// Project: https://github.com/jmesnil/stomp-websocket
// Definitions by: Jimi Charalampidis <https://github.com/jimic>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export const VERSIONS: {
V1_0: string,
V1_1: string,
V1_2: string,
supportedVersions: () => Array<string>
};
export class Client {
connected: boolean;
heartbeat: {
incoming: number,
outgoing: number
};
reconnect_delay: number;
ws: any;
debug(...args: string[]): any;
connect(headers: StompHeaders, connectCallback: (frame?: Frame) => any, errorCallback?: (error: string) => any): any;
connect(login: string, passcode: string, connectCallback: (frame?: Frame) => any, errorCallback?: (error: string) => any, host?: string): any;
disconnect(disconnectCallback?: () => any, headers?: StompHeaders): any;
send(destination: string, headers?: StompHeaders, body?: string): any;
subscribe(destination: string, callback?: (message: Message) => any, headers?: StompHeaders): StompSubscription;
onreceive: (message: Message) => void;
onreceipt: (frame: Frame) => void;
unsubscribe(id: string, headers?: StompHeaders): any;
begin(transaction: string): any;
commit(transaction: string): any;
abort(transaction: string): any;
ack(messageID: string, subscription: string, headers?: StompHeaders): any;
nack(messageID: string, subscription: string, headers?: StompHeaders): any;
}
export interface StompSubscription {
id: string;
unsubscribe(headers?: StompHeaders): void;
}
export class StompHeaders { [key: string]: string }
export class Message extends Frame {
ack(headers?: StompHeaders): any;
nack(headers?: StompHeaders): any;
}
export class Frame {
constructor(command: string, headers?: StompHeaders, body?: string);
command: string;
headers: StompHeaders;
body: string;
toString(): string;
sizeOfUTF8(s: string): number;
unmarshall(datas: any): any;
marshall(command: string, headers?: StompHeaders, body?: string): any;
}
export function client(url: string, protocols?: string | Array<string>): Client;
export function over(ws: any | (() => any)): Client;