Skip to content

Commit bdf6dfb

Browse files
committed
Upgrade instructions for stompjs@6, rx-stomp@1
1 parent c4e44f2 commit bdf6dfb

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
layout: single
3+
title: 'Upgrading to stompjs@6, rx-stomp@1, ng2-stompjs@8'
4+
date: 2020-10-21 22:21:09 +0530
5+
categories: guide stompjs rx-stomp
6+
toc: true
7+
---
8+
9+
These releases are synchronized releases and add similar changes.
10+
It is expected that these releases are fully backwards compatible,
11+
however, you may need to recompile your code.
12+
13+
## User visible changes
14+
15+
### discardWebsocketOnCommFailure
16+
17+
Websocket specification does not provide any mechanism for quickly
18+
dropping a connection.
19+
If the underlying connection is dropped and the incoming pings fail,
20+
actual closure of the Websocket may take significant time (several minutes).
21+
This new option discards the websocket immediately.
22+
This will allow a quicker reconnection.
23+
24+
Under the hood if the Websocket library supports `terminate` method
25+
(which `ws` npm package does), it will call that to quickly drop
26+
the connection.
27+
None of the Web browsers support any equivalent method.
28+
29+
In this release this flag is `off` by default, set it to `true`
30+
to activate it.
31+
32+
```typescript
33+
// Set it directly or part of configuration
34+
client.discardWebsocketOnCommFailure = true;
35+
```
36+
37+
### connectionTimeout
38+
39+
The STOMP standard supports Heartbeats which allows detecting stale connections.
40+
However, this mechanism activates after a successful connection (under the hood,
41+
after `CONNECTED` STOMP frame has been received from the broker).
42+
43+
This setting guards against the case that connection setup takes long time to
44+
establish. If it takes longer it will abandon the attempt and retry.
45+
46+
The value is number of milliseconds to wait for a successful connection.
47+
48+
```typescript
49+
// Set it directly or part of configuration
50+
client.connectionTimeout = 500;
51+
```
52+
53+
### deactivate - async
54+
55+
You are unlikely to be affected by this change.
56+
`deactivate` has now been made `async`, if there is an underlying
57+
active connection, the call will wait till that is terminated.
58+
This prevetents a race condition that may cause more that one
59+
active underlying connection in case `deativate` and `activate` were
60+
invoked in quick succession.
61+
62+
If you were calling `deativate` and `activate` in succession,
63+
you should await for `deativate`.
64+
65+
## Non visible changes
66+
67+
- The output target is `es2015`. We wanted `es2017`, however,
68+
that causes issue with Angular.
69+
- The tree shaking support is quite consistent now.
70+
In previous version `rx-stomp` used `commonjs` module system,
71+
which, was not very friendly to tree shaking.
72+
- Remove dom lib dependency for usage with NodeJS/Typescript.

index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Samples:
3535

3636
## Upgrading
3737

38+
- [Upgrading to stompjs@6, rx-stomp@1, ng2-stompjs@8] - update from
39+
stompjs@v5, [email protected], ng2-stompjs@7.
3840
- [Upgrading StompJS] to update to stompjs@v5 from any of the older versions.
3941
- [Upgrading to ng2-stompjs@7] for any of the older versions.
4042

@@ -64,3 +66,4 @@ Samples:
6466
[Connection status in ng2-stompjs]: {% link _posts/2018-12-18-connection-status-ng2-stompjs.md %}
6567
[FAQs]: {% link _posts/2019-05-20-faqs.html %}
6668
[React Native]: {% link _posts/2019-06-10-react-native-additional-notes.md %}
69+
[Upgrading to stompjs@6, rx-stomp@1, ng2-stompjs@8]: {% link _posts/2020-10-21-upgrading-to-stompjs-6-rx-stomp-1.md %}

0 commit comments

Comments
 (0)