ws-stomp 1.1.0 → 1.1.2

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.
Files changed (2) hide show
  1. package/README.md +15 -26
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![Alt](https://img.shields.io/npm/dt/ws-stomp?style=flat-square)](https://npmcharts.com/compare/ws-stomp?minimal=true)
5
5
  ![Alt](https://img.shields.io/github/license/mivui/ws-stomp?style=flat-square)
6
6
 
7
- ## ws-stomp is a simple nodejs ws stomp server
7
+ ## ws-stomp is a simple Node.js server based on websocket STOMP.
8
8
 
9
9
  ### install
10
10
 
@@ -20,38 +20,27 @@ import wsstomp from 'ws-stomp';
20
20
 
21
21
  const server = createServer();
22
22
  wsstomp.server(server, '/ws');
23
- // ws://lcalhost/ws
24
- ```
25
-
26
- ### express
27
-
28
- ```ts
29
- import express from 'express';
30
- import { Stomp } from 'ws-stomp';
31
-
32
- const app = express();
33
- const server = app.listen();
34
- Stomp.server(server, '/ws');
35
- // ws://lcalhost/ws
23
+ server.listen(3000);
24
+ // ws://lcalhost:3000/ws
36
25
  ```
37
26
 
38
27
  ### send
39
28
 
40
29
  ```ts
41
- import { Stomp } from 'ws-stomp';
30
+ import wsstomp from 'ws-stomp';
42
31
 
43
32
  function publish() {
44
- Stomp.send('/example', JSON.stringify({ name: 'example' }), { token: 'example' });
33
+ wsstomp.send('/topic/something', JSON.stringify({ name: 'name' }), { token: 'token' });
45
34
  }
46
35
  ```
47
36
 
48
37
  ### subscribe
49
38
 
50
39
  ```ts
51
- import { Stomp } from 'ws-stomp';
40
+ import wsstomp from 'ws-stomp';
52
41
 
53
42
  function subscribe() {
54
- Stomp.subscribe('/example', (e) => {
43
+ wsstomp.subscribe('/topic/greetings', (e) => {
55
44
  const body = e.body;
56
45
  });
57
46
  }
@@ -60,10 +49,10 @@ function subscribe() {
60
49
  ### unsubscribe
61
50
 
62
51
  ```ts
63
- import { Stomp } from 'ws-stomp';
52
+ import wsstomp from 'ws-stomp';
64
53
 
65
54
  function unsubscribe() {
66
- Stomp.unsubscribe('/example');
55
+ wsstomp.unsubscribe('/topic/greetings');
67
56
  }
68
57
  ```
69
58
 
@@ -73,16 +62,16 @@ function unsubscribe() {
73
62
 
74
63
  ```ts
75
64
  import express from 'express';
76
- import { Stomp } from 'ws-stomp';
65
+ import wsstomp from 'ws-stomp';
77
66
 
78
67
  const app = express();
79
68
  app.get('/send', (_, res) => {
80
- Stomp.send('/topic/something', 'payload');
69
+ wsstomp.send('/topic/something', 'payload');
81
70
  res.status(200).json({});
82
71
  });
83
- const server = app.listen(8080);
84
- Stomp.server(server, '/ws');
85
- Stomp.subscribe('/topic/greetings', (message) => {
72
+ const server = app.listen(3000);
73
+ wsstomp.server(server, '/ws');
74
+ wsstomp.subscribe('/topic/greetings', (message) => {
86
75
  console.log(message.body);
87
76
  });
88
77
  ```
@@ -93,7 +82,7 @@ Stomp.subscribe('/topic/greetings', (message) => {
93
82
  import { Client } from '@stomp/stompjs';
94
83
 
95
84
  const client = new Client({
96
- brokerURL: 'ws://localhost:8080/ws',
85
+ brokerURL: 'ws://lcalhost:3000/ws',
97
86
  onConnect: () => {
98
87
  client.publish({ destination: '/topic/greetings', body: 'Hello World!' });
99
88
  client.subscribe('/topic/something', (message) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ws-stomp",
3
- "version": "1.1.0",
4
- "description": "ws-stomp",
3
+ "version": "1.1.2",
4
+ "description": "ws-stomp is a simple Node.js server based on websocket STOMP.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.esm.js",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "author": "mivui",
42
42
  "license": "MIT",
43
- "keywords": ["stomp", "ws", "node"],
43
+ "keywords": ["stomp", "ws", "node","websocket"],
44
44
  "repository": {
45
45
  "type": "git",
46
46
  "url": "git+https://github.com/mivui/node-ws-stomp.git"