node-red-contrib-uos-nats 0.1.64 → 0.1.65
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/README.md +50 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,56 @@ Restart Node-RED. The nodes appear in the **"u-OS DataHub NATS"** category in th
|
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
39
|
+
## Why NATS Instead of REST API?
|
|
40
|
+
|
|
41
|
+
The u-OS Data Hub offers both **NATS** (this package) and **REST API** access. Here's why NATS is the better choice for Node-RED:
|
|
42
|
+
|
|
43
|
+
### Feature Comparison
|
|
44
|
+
|
|
45
|
+
| Feature | NATS Protocol | REST API |
|
|
46
|
+
|---------|---------------|----------|
|
|
47
|
+
| **Real-time Updates** | ✅ Event-driven (instant) | ❌ Polling required (delays) |
|
|
48
|
+
| **Performance** | ✅ Binary protocol, high-throughput | ❌ HTTP/JSON overhead |
|
|
49
|
+
| **Communication** | ✅ Bidirectional (Pub/Sub + Request/Reply) | ❌ Client-initiated only |
|
|
50
|
+
| **Provider Registration** | ✅ Dynamic discovery & auto-registration | ❌ Static endpoints |
|
|
51
|
+
| **Scalability** | ✅ Many-to-many connections | ❌ Point-to-point requests |
|
|
52
|
+
| **Network Efficiency** | ✅ Push notifications (no polling waste) | ❌ Repeated GET requests |
|
|
53
|
+
|
|
54
|
+
### Event-Driven Architecture
|
|
55
|
+
|
|
56
|
+
**NATS enables true event-driven workflows:**
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
Sensor changes value
|
|
60
|
+
↓
|
|
61
|
+
Data Hub publishes event via NATS
|
|
62
|
+
↓
|
|
63
|
+
Node-RED receives update INSTANTLY (0ms delay)
|
|
64
|
+
↓
|
|
65
|
+
Process & forward to other systems
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**With REST API you'd need:**
|
|
69
|
+
- Constant polling (e.g., every 100ms)
|
|
70
|
+
- Increased network traffic
|
|
71
|
+
- Delayed reactions
|
|
72
|
+
- Higher CPU usage
|
|
73
|
+
|
|
74
|
+
### Use NATS when:
|
|
75
|
+
|
|
76
|
+
✅ You need **real-time reactions** to value changes
|
|
77
|
+
✅ You want to **create providers** (publish data to Data Hub)
|
|
78
|
+
✅ You need **event subscriptions** (get notified on changes)
|
|
79
|
+
✅ You're building **scalable industrial workflows**
|
|
80
|
+
|
|
81
|
+
### Use REST API when:
|
|
82
|
+
|
|
83
|
+
⚠️ You only need **occasional manual reads**
|
|
84
|
+
⚠️ You're debugging or doing one-time queries
|
|
85
|
+
⚠️ NATS port (49360) is blocked in your network
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
39
89
|
## 1. u-OS Config Node
|
|
40
90
|
|
|
41
91
|
### Purpose
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-uos-nats",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.65",
|
|
4
4
|
"description": "Node-RED nodes for Weidmüller u-OS Data Hub. Read and write variables via NATS protocol with OAuth2 authentication. Supports event-based subscriptions and manual variable mapping.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "IoTUeli",
|