ws-stomp 1.1.3 → 1.1.5
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 +13 -13
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/ws-stomp)
|
|
4
4
|
[](https://npmcharts.com/compare/ws-stomp?minimal=true)
|
|
5
|
-

|
|
5
|
+

|
|
6
6
|
|
|
7
7
|
### ws-stomp is a simple Node.js server base on websocket stomp
|
|
8
8
|
|
|
@@ -16,10 +16,10 @@ npm i ws-stomp
|
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
18
|
import { createServer } from 'http';
|
|
19
|
-
import
|
|
19
|
+
import stomp from 'ws-stomp';
|
|
20
20
|
|
|
21
21
|
const server = createServer();
|
|
22
|
-
|
|
22
|
+
stomp.server(server, '/ws');
|
|
23
23
|
server.listen(3000);
|
|
24
24
|
// ws://lcalhost:3000/ws
|
|
25
25
|
```
|
|
@@ -27,20 +27,20 @@ server.listen(3000);
|
|
|
27
27
|
### send
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
|
-
import
|
|
30
|
+
import stomp from 'ws-stomp';
|
|
31
31
|
|
|
32
32
|
function publish() {
|
|
33
|
-
|
|
33
|
+
stomp.send('/topic/something', JSON.stringify({ name: 'name' }), { token: 'token' });
|
|
34
34
|
}
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
### subscribe
|
|
38
38
|
|
|
39
39
|
```ts
|
|
40
|
-
import
|
|
40
|
+
import stomp from 'ws-stomp';
|
|
41
41
|
|
|
42
42
|
function subscribe() {
|
|
43
|
-
|
|
43
|
+
stomp.subscribe('/topic/greetings', (e) => {
|
|
44
44
|
const body = e.body;
|
|
45
45
|
});
|
|
46
46
|
}
|
|
@@ -49,10 +49,10 @@ function subscribe() {
|
|
|
49
49
|
### unsubscribe
|
|
50
50
|
|
|
51
51
|
```ts
|
|
52
|
-
import
|
|
52
|
+
import stomp from 'ws-stomp';
|
|
53
53
|
|
|
54
54
|
function unsubscribe() {
|
|
55
|
-
|
|
55
|
+
stomp.unsubscribe('/topic/greetings');
|
|
56
56
|
}
|
|
57
57
|
```
|
|
58
58
|
|
|
@@ -62,16 +62,16 @@ function unsubscribe() {
|
|
|
62
62
|
|
|
63
63
|
```ts
|
|
64
64
|
import express from 'express';
|
|
65
|
-
import
|
|
65
|
+
import stomp from 'ws-stomp';
|
|
66
66
|
|
|
67
67
|
const app = express();
|
|
68
68
|
app.get('/send', (_, res) => {
|
|
69
|
-
|
|
69
|
+
stomp.send('/topic/something', 'payload');
|
|
70
70
|
res.status(200).json({});
|
|
71
71
|
});
|
|
72
72
|
const server = app.listen(3000);
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
stomp.server(server, '/ws');
|
|
74
|
+
stomp.subscribe('/topic/greetings', (message) => {
|
|
75
75
|
console.log(message.body);
|
|
76
76
|
});
|
|
77
77
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ws-stomp",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "ws-stomp is a simple Node.js server base on websocket stomp",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -29,14 +29,13 @@
|
|
|
29
29
|
"@rollup/plugin-replace": "^6.0.3",
|
|
30
30
|
"@rollup/plugin-terser": "^0.4.4",
|
|
31
31
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
32
|
-
"@types/node": "^24.10.
|
|
33
|
-
"
|
|
34
|
-
"rollup": "^4.55.3",
|
|
32
|
+
"@types/node": "^24.10.15",
|
|
33
|
+
"rollup": "^4.59.0",
|
|
35
34
|
"rollup-plugin-dts": "^6.3.0",
|
|
36
35
|
"tslib": "^2.8.1",
|
|
37
36
|
"typescript": "^5.9.3",
|
|
38
|
-
"typescript-eslint-standard": "^
|
|
39
|
-
"vitest": "^4.0.
|
|
37
|
+
"typescript-eslint-standard": "^10.0.0",
|
|
38
|
+
"vitest": "^4.0.18"
|
|
40
39
|
},
|
|
41
40
|
"author": "mivui",
|
|
42
41
|
"license": "MIT",
|