@openrfid/websocket 0.1.0 → 1.0.0
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 +84 -0
- package/package.json +6 -5
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="https://raw.githubusercontent.com/rfidsoftwares/openrfid-simulator/main/assets/logo.svg" alt="OpenRFID Simulator Logo" width="180" />
|
|
4
|
+
|
|
5
|
+
# `@openrfid/websocket`
|
|
6
|
+
|
|
7
|
+
### Sub-10ms Real-Time WebSocket Tag Stream Broadcaster Plugin
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@openrfid/websocket)
|
|
10
|
+
[](https://opensource.org/licenses/MIT)
|
|
11
|
+
[](https://rfidsoftwares.com)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 🚀 Overview
|
|
18
|
+
|
|
19
|
+
`@openrfid/websocket` is the real-time streaming protocol plugin for **OpenRFID Simulator**. It creates a low-latency WebSocket server (`ws://localhost:3101`) that streams sub-10ms JSON tag detection events directly to web SPA consoles, mobile apps, or enterprise event monitoring dashboards.
|
|
20
|
+
|
|
21
|
+
Developed & Maintained by **[RFID Software India Private Limited](https://rfidsoftwares.com)**.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 📦 Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# npm
|
|
29
|
+
npm install @openrfid/websocket
|
|
30
|
+
|
|
31
|
+
# pnpm
|
|
32
|
+
pnpm add @openrfid/websocket
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 💻 Code Example
|
|
38
|
+
|
|
39
|
+
### 1. Register WebSocket Broadcaster Plugin
|
|
40
|
+
```typescript
|
|
41
|
+
import { SimulationEngine } from '@openrfid/simulator';
|
|
42
|
+
import { WebSocketPlugin } from '@openrfid/websocket';
|
|
43
|
+
|
|
44
|
+
const engine = new SimulationEngine();
|
|
45
|
+
|
|
46
|
+
// Instantiate WebSocket Broadcaster plugin on port 3101
|
|
47
|
+
const wsPlugin = new WebSocketPlugin({
|
|
48
|
+
port: 3101,
|
|
49
|
+
path: '/ws/tags'
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
await engine.pluginManager.registerPlugin(wsPlugin);
|
|
53
|
+
await engine.start();
|
|
54
|
+
|
|
55
|
+
console.log('WebSocket Broadcaster active on ws://localhost:3101/ws/tags');
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 2. Connect from Client Browser
|
|
59
|
+
```javascript
|
|
60
|
+
const socket = new WebSocket('ws://localhost:3101/ws/tags');
|
|
61
|
+
|
|
62
|
+
socket.onmessage = (event) => {
|
|
63
|
+
const data = JSON.parse(event.data);
|
|
64
|
+
console.log('Tag Detection Event:', data.epc, 'RSSI:', data.rssi);
|
|
65
|
+
};
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 🌐 Monorepo Ecosystem
|
|
71
|
+
|
|
72
|
+
| Package | Description |
|
|
73
|
+
| :--- | :--- |
|
|
74
|
+
| [`@openrfid/plugin-api`](https://www.npmjs.com/package/@openrfid/plugin-api) | Plugin lifecycle interfaces & sandbox manager |
|
|
75
|
+
| [`@openrfid/rest`](https://www.npmjs.com/package/@openrfid/rest) | Fastify REST API plugin |
|
|
76
|
+
| [`@openrfid/mqtt`](https://www.npmjs.com/package/@openrfid/mqtt) | MQTT IoT publisher plugin |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 📄 License & Corporate Support
|
|
81
|
+
|
|
82
|
+
Licensed under the **MIT License**.
|
|
83
|
+
Brought to you by **RFID Software India Private Limited**.
|
|
84
|
+
For enterprise RFID middleware, hardware drivers, or custom protocol plugins, visit **[rfidsoftwares.com](https://rfidsoftwares.com)**.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrfid/websocket",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Real-time WebSocket broadcasting server plugin for OpenRFID Simulator.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -13,19 +13,20 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
-
"dist"
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
17
18
|
],
|
|
18
19
|
"dependencies": {
|
|
19
20
|
"ws": "^8.16.0",
|
|
20
|
-
"@openrfid/
|
|
21
|
-
"@openrfid/
|
|
21
|
+
"@openrfid/plugin-api": "1.0.0",
|
|
22
|
+
"@openrfid/core": "1.0.0"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@types/ws": "^8.5.10",
|
|
25
26
|
"tsup": "^8.0.2",
|
|
26
27
|
"typescript": "^5.4.5",
|
|
27
28
|
"vitest": "^1.5.0",
|
|
28
|
-
"@openrfid/simulator": "
|
|
29
|
+
"@openrfid/simulator": "1.0.0"
|
|
29
30
|
},
|
|
30
31
|
"publishConfig": {
|
|
31
32
|
"access": "public"
|