node-red-contrib-ntrip 0.2.8 → 0.2.9

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.
@@ -19,7 +19,7 @@ jobs:
19
19
  # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
20
20
 
21
21
  steps:
22
- - uses: actions/checkout@v6
22
+ - uses: actions/checkout@v7
23
23
  - name: Use Node.js ${{ matrix.node-version }}
24
24
  uses: actions/setup-node@v6
25
25
  with:
@@ -23,7 +23,7 @@ jobs:
23
23
  matrix:
24
24
  node-version: [18.x, 20.x, 22.x]
25
25
  steps:
26
- - uses: actions/checkout@v6
26
+ - uses: actions/checkout@v7
27
27
  - name: Use Node.js ${{ matrix.node-version }}
28
28
  uses: actions/setup-node@v6
29
29
  with:
@@ -38,7 +38,7 @@ jobs:
38
38
  needs: test
39
39
  runs-on: ubuntu-latest
40
40
  steps:
41
- - uses: actions/checkout@v6
41
+ - uses: actions/checkout@v7
42
42
  - uses: actions/setup-node@v6
43
43
  with:
44
44
  node-version: 20
@@ -54,7 +54,7 @@ jobs:
54
54
  permissions:
55
55
  contents: write
56
56
  steps:
57
- - uses: actions/checkout@v6
57
+ - uses: actions/checkout@v7
58
58
  with:
59
59
  fetch-depth: 0
60
60
  - name: Create GitHub Release
package/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.2.9]
5
+ ### NtripClient
6
+ - Status badge now shows the inbound data rate alongside the Rx/Tx message counters (e.g. `2.4 kbps Rx 123 Tx 4`). The rate is sampled once per second and formatted as `bps`, `kbps`, or `Mbps` depending on magnitude.
7
+
8
+ ### Internal — dependency bumps (dev tree, no runtime changes)
9
+ - `node-red` 4.1.11 → 5.0.1 (via the sigstore/node-red bundle).
10
+ - `eslint` 10.4.1 → 10.6.0.
11
+ - `prettier` 3.8.3 → 3.9.3.
12
+ - `mocha` 11.7.5 → 11.7.6.
13
+ - `globals` 17.6.0 → 17.7.0.
14
+ - `actions/checkout` v6 → v7 in the CI + release workflows.
15
+
4
16
  ## [0.2.8]
5
17
  ### Added RTCM Encoder node
6
18
  - New `RtcmEncoder` node — inverse of `RtcmDecoder`. Accepts an `RtcmMessage` instance (or `msg.payload.message` from the decoder) and emits the encoded RTCM 3 frame as `msg.payload.rtcmMessage` (Buffer).
package/README.md CHANGED
@@ -292,8 +292,10 @@ A few things that are easy to get wrong:
292
292
  interleaved with bytes received from the caster. Downstream nodes will see
293
293
  both streams on the same wire — distinguish them with a tag in a function
294
294
  node if you need to.
295
- - **NTRIP Client: status badge.** `Rx N Tx M` counts inbound and outbound
296
- messages separately. Handshake replies do not bump the inbound count.
295
+ - **NTRIP Client: status badge.** `<rate> Rx N Tx M` shows the inbound data
296
+ rate (sampled over a 1-second window; formatted as `bps`, `kbps`, or `Mbps`)
297
+ followed by the inbound and outbound message counts. Handshake replies do
298
+ not bump the inbound count.
297
299
  - **NTRIP Client: CR/LF in credentials.** `mountpoint`, `username`, and
298
300
  `password` are interpolated into the handshake string. CR/LF in these fields
299
301
  is rejected at startup to prevent header injection.
@@ -209,8 +209,11 @@
209
209
  <h3>Status</h3>
210
210
  <p>The node shows <code>connecting…</code> until the caster acknowledges the
211
211
  handshake with <code>ICY 200 OK</code>. After that it shows the running
212
- <code>Rx</code> / <code>Tx</code> counters. A red badge indicates a rejected
213
- connection, a missing mountpoint, or a write failure.</p>
212
+ <code>Rx</code> / <code>Tx</code> message counters plus the inbound data
213
+ rate in <code>bps</code> / <code>kbps</code> / <code>Mbps</code>, sampled
214
+ once per second over a 1-second window
215
+ (e.g. <code>2.4 kbps Rx 123 Tx 4</code>). A red badge indicates a
216
+ rejected connection, a missing mountpoint, or a write failure.</p>
214
217
 
215
218
  <h3>Details</h3>
216
219
  <p>The first <code>ICY 200 OK</code>, <code>ICY 406</code>, or
@@ -7,11 +7,23 @@ module.exports = function (RED) {
7
7
  const NtripServerMissingMountpoint = 'SOURCETABLE 200 OK';
8
8
  const HandshakePrefixBytes = 64;
9
9
 
10
+ function formatBps(bps) {
11
+ if (bps < 1000) {
12
+ return Math.round(bps) + ' bps';
13
+ }
14
+ if (bps < 1000000) {
15
+ return (bps / 1000).toFixed(1) + ' kbps';
16
+ }
17
+ return (bps / 1000000).toFixed(2) + ' Mbps';
18
+ }
19
+
10
20
  function NtripClientNode(config) {
11
21
  RED.nodes.createNode(this, config);
12
22
  let node = this;
13
23
  node.messagesReceived = 0;
14
24
  node.messagesSent = 0;
25
+ node.bytesAccum = 0;
26
+ node.currentBps = 0;
15
27
  node.passthrough = config.passthrough || false;
16
28
 
17
29
  let host = typeof config.host === 'string' ? config.host.trim() : '';
@@ -70,11 +82,21 @@ module.exports = function (RED) {
70
82
  node.status({
71
83
  fill: 'green',
72
84
  shape: 'ring',
73
- text: 'Rx ' + node.messagesReceived + ' Tx ' + node.messagesSent,
85
+ text: formatBps(node.currentBps) + ' Rx ' + node.messagesReceived + ' Tx ' + node.messagesSent,
74
86
  });
75
87
  }
76
88
 
89
+ // Sample inbound byte counter once per second to compute the bps shown in the
90
+ // status badge. Counter is reset each tick — currentBps reflects the most
91
+ // recent 1-second window.
92
+ const bpsSampler = setInterval(() => {
93
+ node.currentBps = node.bytesAccum * 8;
94
+ node.bytesAccum = 0;
95
+ updateStatus();
96
+ }, 1000);
97
+
77
98
  client.on('data', (data) => {
99
+ node.bytesAccum += data.length;
78
100
  if (!connected) {
79
101
  let prefix = data.toString('utf8', 0, Math.min(data.length, HandshakePrefixBytes));
80
102
  if (prefix.startsWith(NtripServerOkReply)) {
@@ -163,6 +185,7 @@ module.exports = function (RED) {
163
185
  });
164
186
 
165
187
  this.on('close', function (done) {
188
+ clearInterval(bpsSampler);
166
189
  try {
167
190
  client.removeAllListeners();
168
191
  client.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-ntrip",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Node for ntrip and rtcm handling.",
5
5
  "node-red": {
6
6
  "version": ">=0.1.0",
@@ -43,7 +43,7 @@
43
43
  "eslint-config-prettier": "^10.1.8",
44
44
  "globals": "^17.6.0",
45
45
  "mocha": "^11.7.5",
46
- "node-red": "^4.1.10",
46
+ "node-red": "^5.0.1",
47
47
  "node-red-node-test-helper": "^0.3.6",
48
48
  "prettier": "^3.8.3"
49
49
  }