UNPKG

1.04 kBJavaScriptView Raw
1/**
2 * Supported STOMP versions
3 *
4 * Part of `@stomp/stompjs`.
5 */
6export class Versions {
7 /**
8 * Takes an array of string of versions, typical elements '1.0', '1.1', or '1.2'
9 *
10 * You will an instance if this class if you want to override supported versions to be declared during
11 * STOMP handshake.
12 */
13 constructor(versions) {
14 this.versions = versions;
15 }
16 /**
17 * Used as part of CONNECT STOMP Frame
18 */
19 supportedVersions() {
20 return this.versions.join(',');
21 }
22 /**
23 * Used while creating a WebSocket
24 */
25 protocolVersions() {
26 return this.versions.map(x => `v${x.replace('.', '')}.stomp`);
27 }
28}
29/**
30 * Indicates protocol version 1.0
31 */
32Versions.V1_0 = '1.0';
33/**
34 * Indicates protocol version 1.1
35 */
36Versions.V1_1 = '1.1';
37/**
38 * Indicates protocol version 1.2
39 */
40Versions.V1_2 = '1.2';
41/**
42 * @internal
43 */
44Versions.default = new Versions([
45 Versions.V1_0,
46 Versions.V1_1,
47 Versions.V1_2,
48]);
49//# sourceMappingURL=versions.js.map
\No newline at end of file