@stomp/stompjs 7.0.0-beta3 → 7.0.0-beta4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm6/index.d.ts +13 -2
- package/esm6/index.js +14 -2
- package/esm6/index.js.map +1 -1
- package/esm6/types.d.ts +4 -4
- package/package.json +2 -2
- package/src/index.ts +15 -2
- package/src/types.ts +4 -4
- package/bundles/tcp-wrapper.cjs +0 -84
- package/bundles/tcp-wrapper.cjs.map +0 -1
- package/esm6/index-web.d.ts +0 -13
- package/esm6/index-web.js +0 -15
- package/esm6/index-web.js.map +0 -1
- package/esm6/tcp-wrapper.d.ts +0 -18
- package/esm6/tcp-wrapper.js +0 -61
- package/esm6/tcp-wrapper.js.map +0 -1
- package/src/index-web.ts +0 -15
- package/src/tcp-wrapper.ts +0 -83
package/esm6/index.d.ts
CHANGED
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './client.js';
|
|
2
|
+
export * from './frame-impl.js';
|
|
3
|
+
export * from './i-frame.js';
|
|
4
|
+
export * from './i-message.js';
|
|
5
|
+
export * from './parser.js';
|
|
6
|
+
export * from './stomp-config.js';
|
|
7
|
+
export * from './stomp-headers.js';
|
|
8
|
+
export * from './stomp-subscription.js';
|
|
9
|
+
export * from './i-transaction.js';
|
|
10
|
+
export * from './types.js';
|
|
11
|
+
export * from './versions.js';
|
|
12
|
+
export * from './compatibility/compat-client.js';
|
|
13
|
+
export * from './compatibility/stomp.js';
|
package/esm6/index.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './client.js';
|
|
2
|
+
export * from './frame-impl.js';
|
|
3
|
+
export * from './i-frame.js';
|
|
4
|
+
export * from './i-message.js';
|
|
5
|
+
export * from './parser.js';
|
|
6
|
+
export * from './stomp-config.js';
|
|
7
|
+
export * from './stomp-headers.js';
|
|
8
|
+
export * from './stomp-subscription.js';
|
|
9
|
+
export * from './i-transaction.js';
|
|
10
|
+
export * from './types.js';
|
|
11
|
+
export * from './versions.js';
|
|
12
|
+
// Compatibility code
|
|
13
|
+
export * from './compatibility/compat-client.js';
|
|
14
|
+
export * from './compatibility/stomp.js';
|
|
3
15
|
//# sourceMappingURL=index.js.map
|
package/esm6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAE9B,qBAAqB;AACrB,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC"}
|
package/esm6/types.d.ts
CHANGED
|
@@ -100,11 +100,11 @@ export interface IStompSocketMessageEvent {
|
|
|
100
100
|
*/
|
|
101
101
|
export interface IStompSocket {
|
|
102
102
|
url: string;
|
|
103
|
-
onclose: ((
|
|
104
|
-
onerror: ((
|
|
103
|
+
onclose: ((ev?: any) => any) | undefined | null;
|
|
104
|
+
onerror: ((ev: any) => any) | undefined | null;
|
|
105
105
|
onmessage: ((ev: IStompSocketMessageEvent) => any) | undefined | null;
|
|
106
|
-
onopen: ((
|
|
107
|
-
terminate?: ((
|
|
106
|
+
onopen: ((ev?: any) => any) | undefined | null;
|
|
107
|
+
terminate?: (() => any) | undefined | null;
|
|
108
108
|
/**
|
|
109
109
|
* Returns a string that indicates how binary data from the socket is exposed to scripts:
|
|
110
110
|
* We support only 'arraybuffer'.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stomp/stompjs",
|
|
3
|
-
"version": "7.0.0-
|
|
3
|
+
"version": "7.0.0-beta4",
|
|
4
4
|
"description": "STOMP client for Javascript and Typescript",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rm -rf bundles esm6",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"homepage": "https://github.com/stomp-js/stompjs#readme",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@chiragrupani/karma-chromium-edge-launcher": "^2.2.2",
|
|
37
|
-
"@rollup/plugin-terser": "^0.
|
|
37
|
+
"@rollup/plugin-terser": "^0.4.0",
|
|
38
38
|
"@rollup/plugin-typescript": "^11.0.0",
|
|
39
39
|
"jasmine": "^4.3.0",
|
|
40
40
|
"karma": "^6.4.0",
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './client.js';
|
|
2
|
+
export * from './frame-impl.js';
|
|
3
|
+
export * from './i-frame.js';
|
|
4
|
+
export * from './i-message.js';
|
|
5
|
+
export * from './parser.js';
|
|
6
|
+
export * from './stomp-config.js';
|
|
7
|
+
export * from './stomp-headers.js';
|
|
8
|
+
export * from './stomp-subscription.js';
|
|
9
|
+
export * from './i-transaction.js';
|
|
10
|
+
export * from './types.js';
|
|
11
|
+
export * from './versions.js';
|
|
12
|
+
|
|
13
|
+
// Compatibility code
|
|
14
|
+
export * from './compatibility/compat-client.js';
|
|
15
|
+
export * from './compatibility/stomp.js';
|
package/src/types.ts
CHANGED
|
@@ -111,11 +111,11 @@ export interface IStompSocketMessageEvent {
|
|
|
111
111
|
*/
|
|
112
112
|
export interface IStompSocket {
|
|
113
113
|
url: string;
|
|
114
|
-
onclose: ((
|
|
115
|
-
onerror: ((
|
|
114
|
+
onclose: ((ev?: any) => any) | undefined | null;
|
|
115
|
+
onerror: ((ev: any) => any) | undefined | null;
|
|
116
116
|
onmessage: ((ev: IStompSocketMessageEvent) => any) | undefined | null;
|
|
117
|
-
onopen: ((
|
|
118
|
-
terminate?: ((
|
|
117
|
+
onopen: ((ev?: any) => any) | undefined | null;
|
|
118
|
+
terminate?: (() => any) | undefined | null;
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
121
|
* Returns a string that indicates how binary data from the socket is exposed to scripts:
|
package/bundles/tcp-wrapper.cjs
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var net = require('net');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Possible states for the IStompSocket
|
|
7
|
-
*/
|
|
8
|
-
var StompSocketState;
|
|
9
|
-
(function (StompSocketState) {
|
|
10
|
-
StompSocketState[StompSocketState["CONNECTING"] = 0] = "CONNECTING";
|
|
11
|
-
StompSocketState[StompSocketState["OPEN"] = 1] = "OPEN";
|
|
12
|
-
StompSocketState[StompSocketState["CLOSING"] = 2] = "CLOSING";
|
|
13
|
-
StompSocketState[StompSocketState["CLOSED"] = 3] = "CLOSED";
|
|
14
|
-
})(StompSocketState = StompSocketState || (StompSocketState = {}));
|
|
15
|
-
/**
|
|
16
|
-
* Possible activation state
|
|
17
|
-
*/
|
|
18
|
-
var ActivationState;
|
|
19
|
-
(function (ActivationState) {
|
|
20
|
-
ActivationState[ActivationState["ACTIVE"] = 0] = "ACTIVE";
|
|
21
|
-
ActivationState[ActivationState["DEACTIVATING"] = 1] = "DEACTIVATING";
|
|
22
|
-
ActivationState[ActivationState["INACTIVE"] = 2] = "INACTIVE";
|
|
23
|
-
})(ActivationState = ActivationState || (ActivationState = {}));
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Wrapper for a TCP socket to make it behave similar to the WebSocket interface
|
|
27
|
-
*/
|
|
28
|
-
class TCPWrapper {
|
|
29
|
-
constructor(host, port) {
|
|
30
|
-
this.url = `tcp://${host}/${port}/`;
|
|
31
|
-
this.readyState = StompSocketState.CONNECTING;
|
|
32
|
-
this.socket = net.createConnection(port, host, () => {
|
|
33
|
-
if (typeof this.onopen === 'function') {
|
|
34
|
-
this.readyState = StompSocketState.OPEN;
|
|
35
|
-
this.onopen();
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
this.socket.on('data', ev => {
|
|
39
|
-
if (typeof this.onmessage === 'function') {
|
|
40
|
-
this.onmessage({ data: ev });
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
this.socket.on('close', hadError => {
|
|
44
|
-
this.readyState = StompSocketState.CLOSED;
|
|
45
|
-
if (typeof this.onclose === 'function') {
|
|
46
|
-
if (this._closeEvtOnTermination) {
|
|
47
|
-
this.onclose(this._closeEvtOnTermination);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
this.onclose({ wasClean: !hadError, type: 'CloseEvent', code: 1000 });
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
this.socket.on('error', ev => {
|
|
55
|
-
if (typeof this.onerror === 'function') {
|
|
56
|
-
this.onerror({ type: 'Error', error: 100, message: ev });
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
send(data) {
|
|
61
|
-
if (typeof data === 'string') {
|
|
62
|
-
this.socket.write(data);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
this.socket.write(new Uint8Array(data));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
close(code, reason) {
|
|
69
|
-
this.readyState = StompSocketState.CLOSING;
|
|
70
|
-
this.socket.end();
|
|
71
|
-
}
|
|
72
|
-
terminate() {
|
|
73
|
-
this.readyState = StompSocketState.CLOSING;
|
|
74
|
-
this._closeEvtOnTermination = {
|
|
75
|
-
wasClean: false,
|
|
76
|
-
type: 'CloseEvent',
|
|
77
|
-
code: 4001,
|
|
78
|
-
};
|
|
79
|
-
this.socket.destroy();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
exports.TCPWrapper = TCPWrapper;
|
|
84
|
-
//# sourceMappingURL=tcp-wrapper.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tcp-wrapper.cjs","sources":["../src/types.ts","../src/tcp-wrapper.ts"],"sourcesContent":[null,null],"names":["createConnection"],"mappings":";;;;AA4IA;;AAEG;AACH,IAAY,gBAKX,CAAA;AALD,CAAA,UAAY,gBAAgB,EAAA;AAC1B,IAAA,gBAAA,CAAA,gBAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAU,CAAA;AACV,IAAA,gBAAA,CAAA,gBAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;AACJ,IAAA,gBAAA,CAAA,gBAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAO,CAAA;AACP,IAAA,gBAAA,CAAA,gBAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAM,CAAA;AACR,CAAC,EALW,gBAAgB,GAAhB,gBAAgB,KAAhB,gBAAgB,GAK3B,EAAA,CAAA,CAAA,CAAA;AAED;;AAEG;AACH,IAAY,eAIX,CAAA;AAJD,CAAA,UAAY,eAAe,EAAA;AACzB,IAAA,eAAA,CAAA,eAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAM,CAAA;AACN,IAAA,eAAA,CAAA,eAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAY,CAAA;AACZ,IAAA,eAAA,CAAA,eAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ,CAAA;AACV,CAAC,EAJW,eAAe,GAAf,eAAe,KAAf,eAAe,GAI1B,EAAA,CAAA,CAAA;;ACtJD;;AAEG;MACU,UAAU,CAAA;IAarB,W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M,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,IAAG;AAC3B,YAAA,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,EAAE;AACtC,gBAAA,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1D,aAAA;AACH,SAAC,CAAC,CAAC;KACJ;AAEM,IAAA,IAAI,CAAC,IAA0B,EAAA;AACpC,QAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC5B,YAAA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACzB,SAAA;AAAM,aAAA;YACL,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AACzC,SAAA;KACF;IAEM,KAAK,CAAC,IAAa,EAAE,MAAe,EAAA;AACzC,QAAA,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC;AAC3C,QAAA,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;KACnB;IAEM,SAAS,GAAA;AACd,QAAA,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC;QAC3C,IAAI,CAAC,sBAAsB,GAAG;AAC5B,YAAA,QAAQ,EAAE,KAAK;AACf,YAAA,IAAI,EAAE,YAAY;AAClB,YAAA,IAAI,EAAE,IAAI;SACX,CAAC;AACF,QAAA,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;KACvB;AACF;;;;"}
|
package/esm6/index-web.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from './client.js';
|
|
2
|
-
export * from './frame-impl.js';
|
|
3
|
-
export * from './i-frame.js';
|
|
4
|
-
export * from './i-message.js';
|
|
5
|
-
export * from './parser.js';
|
|
6
|
-
export * from './stomp-config.js';
|
|
7
|
-
export * from './stomp-headers.js';
|
|
8
|
-
export * from './stomp-subscription.js';
|
|
9
|
-
export * from './i-transaction.js';
|
|
10
|
-
export * from './types.js';
|
|
11
|
-
export * from './versions.js';
|
|
12
|
-
export * from './compatibility/compat-client.js';
|
|
13
|
-
export * from './compatibility/stomp.js';
|
package/esm6/index-web.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export * from './client.js';
|
|
2
|
-
export * from './frame-impl.js';
|
|
3
|
-
export * from './i-frame.js';
|
|
4
|
-
export * from './i-message.js';
|
|
5
|
-
export * from './parser.js';
|
|
6
|
-
export * from './stomp-config.js';
|
|
7
|
-
export * from './stomp-headers.js';
|
|
8
|
-
export * from './stomp-subscription.js';
|
|
9
|
-
export * from './i-transaction.js';
|
|
10
|
-
export * from './types.js';
|
|
11
|
-
export * from './versions.js';
|
|
12
|
-
// Compatibility code
|
|
13
|
-
export * from './compatibility/compat-client.js';
|
|
14
|
-
export * from './compatibility/stomp.js';
|
|
15
|
-
//# sourceMappingURL=index-web.js.map
|
package/esm6/index-web.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-web.js","sourceRoot":"","sources":["../src/index-web.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAE9B,qBAAqB;AACrB,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC"}
|
package/esm6/tcp-wrapper.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { IStompSocket, IStompSocketMessageEvent, StompSocketState } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Wrapper for a TCP socket to make it behave similar to the WebSocket interface
|
|
4
|
-
*/
|
|
5
|
-
export declare class TCPWrapper implements IStompSocket {
|
|
6
|
-
readyState: StompSocketState;
|
|
7
|
-
readonly url: string;
|
|
8
|
-
onclose: ((this: IStompSocket, ev?: any) => any) | undefined | null;
|
|
9
|
-
onerror: ((this: IStompSocket, ev: any) => any) | undefined | null;
|
|
10
|
-
onmessage: ((this: IStompSocket, ev: IStompSocketMessageEvent) => any) | undefined | null;
|
|
11
|
-
onopen: ((this: IStompSocket, ev?: any) => any) | undefined | null;
|
|
12
|
-
private socket;
|
|
13
|
-
private _closeEvtOnTermination;
|
|
14
|
-
constructor(host: string, port: number);
|
|
15
|
-
send(data: string | ArrayBuffer): void;
|
|
16
|
-
close(code?: number, reason?: string): void;
|
|
17
|
-
terminate(): void;
|
|
18
|
-
}
|
package/esm6/tcp-wrapper.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { createConnection } from 'net';
|
|
2
|
-
import { StompSocketState, } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Wrapper for a TCP socket to make it behave similar to the WebSocket interface
|
|
5
|
-
*/
|
|
6
|
-
export class TCPWrapper {
|
|
7
|
-
constructor(host, port) {
|
|
8
|
-
const noOp = () => { };
|
|
9
|
-
this.url = `tcp://${host}/${port}/`;
|
|
10
|
-
this.readyState = StompSocketState.CONNECTING;
|
|
11
|
-
this.socket = createConnection(port, host, () => {
|
|
12
|
-
if (typeof this.onopen === 'function') {
|
|
13
|
-
this.readyState = StompSocketState.OPEN;
|
|
14
|
-
this.onopen();
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
this.socket.on('data', ev => {
|
|
18
|
-
if (typeof this.onmessage === 'function') {
|
|
19
|
-
this.onmessage({ data: ev });
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
this.socket.on('close', hadError => {
|
|
23
|
-
this.readyState = StompSocketState.CLOSED;
|
|
24
|
-
if (typeof this.onclose === 'function') {
|
|
25
|
-
if (this._closeEvtOnTermination) {
|
|
26
|
-
this.onclose(this._closeEvtOnTermination);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
this.onclose({ wasClean: !hadError, type: 'CloseEvent', code: 1000 });
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
this.socket.on('error', ev => {
|
|
34
|
-
if (typeof this.onerror === 'function') {
|
|
35
|
-
this.onerror({ type: 'Error', error: 100, message: ev });
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
send(data) {
|
|
40
|
-
if (typeof data === 'string') {
|
|
41
|
-
this.socket.write(data);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
this.socket.write(new Uint8Array(data));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
close(code, reason) {
|
|
48
|
-
this.readyState = StompSocketState.CLOSING;
|
|
49
|
-
this.socket.end();
|
|
50
|
-
}
|
|
51
|
-
terminate() {
|
|
52
|
-
this.readyState = StompSocketState.CLOSING;
|
|
53
|
-
this._closeEvtOnTermination = {
|
|
54
|
-
wasClean: false,
|
|
55
|
-
type: 'CloseEvent',
|
|
56
|
-
code: 4001,
|
|
57
|
-
};
|
|
58
|
-
this.socket.destroy();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=tcp-wrapper.js.map
|
package/esm6/tcp-wrapper.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tcp-wrapper.js","sourceRoot":"","sources":["../src/tcp-wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAU,MAAM,KAAK,CAAC;AAC/C,OAAO,EAGL,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,OAAO,UAAU;IAarB,YAAY,IAAY,EAAE,IAAY;QACpC,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE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IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;aAC1D;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,IAAI,CAAC,IAA0B;QACpC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC5B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SACzB;aAAM;YACL,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;SACzC;IACH,CAAC;IAEM,KAAK,CAAC,IAAa,EAAE,MAAe;QACzC,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC;QAC3C,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;IAEM,SAAS;QACd,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC;QAC3C,IAAI,CAAC,sBAAsB,GAAG;YAC5B,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,IAAI;SACX,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;CACF"}
|
package/src/index-web.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export * from './client.js';
|
|
2
|
-
export * from './frame-impl.js';
|
|
3
|
-
export * from './i-frame.js';
|
|
4
|
-
export * from './i-message.js';
|
|
5
|
-
export * from './parser.js';
|
|
6
|
-
export * from './stomp-config.js';
|
|
7
|
-
export * from './stomp-headers.js';
|
|
8
|
-
export * from './stomp-subscription.js';
|
|
9
|
-
export * from './i-transaction.js';
|
|
10
|
-
export * from './types.js';
|
|
11
|
-
export * from './versions.js';
|
|
12
|
-
|
|
13
|
-
// Compatibility code
|
|
14
|
-
export * from './compatibility/compat-client.js';
|
|
15
|
-
export * from './compatibility/stomp.js';
|
package/src/tcp-wrapper.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { createConnection, Socket } from 'net';
|
|
2
|
-
import {
|
|
3
|
-
IStompSocket,
|
|
4
|
-
IStompSocketMessageEvent,
|
|
5
|
-
StompSocketState,
|
|
6
|
-
} from './types.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Wrapper for a TCP socket to make it behave similar to the WebSocket interface
|
|
10
|
-
*/
|
|
11
|
-
export class TCPWrapper implements IStompSocket {
|
|
12
|
-
public readyState: StompSocketState;
|
|
13
|
-
public readonly url: string;
|
|
14
|
-
public onclose: ((this: IStompSocket, ev?: any) => any) | undefined | null;
|
|
15
|
-
public onerror: ((this: IStompSocket, ev: any) => any) | undefined | null;
|
|
16
|
-
public onmessage:
|
|
17
|
-
| ((this: IStompSocket, ev: IStompSocketMessageEvent) => any)
|
|
18
|
-
| undefined
|
|
19
|
-
| null;
|
|
20
|
-
public onopen: ((this: IStompSocket, ev?: any) => any) | undefined | null;
|
|
21
|
-
private socket: Socket;
|
|
22
|
-
private _closeEvtOnTermination: object | undefined;
|
|
23
|
-
|
|
24
|
-
constructor(host: string, port: number) {
|
|
25
|
-
const noOp = () => {};
|
|
26
|
-
|
|
27
|
-
this.url = `tcp://${host}/${port}/`;
|
|
28
|
-
this.readyState = StompSocketState.CONNECTING;
|
|
29
|
-
|
|
30
|
-
this.socket = createConnection(port, host, () => {
|
|
31
|
-
if (typeof this.onopen === 'function') {
|
|
32
|
-
this.readyState = StompSocketState.OPEN;
|
|
33
|
-
this.onopen();
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
this.socket.on('data', ev => {
|
|
38
|
-
if (typeof this.onmessage === 'function') {
|
|
39
|
-
this.onmessage({ data: ev });
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
this.socket.on('close', hadError => {
|
|
44
|
-
this.readyState = StompSocketState.CLOSED;
|
|
45
|
-
if (typeof this.onclose === 'function') {
|
|
46
|
-
if (this._closeEvtOnTermination) {
|
|
47
|
-
this.onclose(this._closeEvtOnTermination);
|
|
48
|
-
} else {
|
|
49
|
-
this.onclose({ wasClean: !hadError, type: 'CloseEvent', code: 1000 });
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
this.socket.on('error', ev => {
|
|
55
|
-
if (typeof this.onerror === 'function') {
|
|
56
|
-
this.onerror({ type: 'Error', error: 100, message: ev });
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public send(data: string | ArrayBuffer) {
|
|
62
|
-
if (typeof data === 'string') {
|
|
63
|
-
this.socket.write(data);
|
|
64
|
-
} else {
|
|
65
|
-
this.socket.write(new Uint8Array(data));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public close(code?: number, reason?: string) {
|
|
70
|
-
this.readyState = StompSocketState.CLOSING;
|
|
71
|
-
this.socket.end();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public terminate() {
|
|
75
|
-
this.readyState = StompSocketState.CLOSING;
|
|
76
|
-
this._closeEvtOnTermination = {
|
|
77
|
-
wasClean: false,
|
|
78
|
-
type: 'CloseEvent',
|
|
79
|
-
code: 4001,
|
|
80
|
-
};
|
|
81
|
-
this.socket.destroy();
|
|
82
|
-
}
|
|
83
|
-
}
|