ws-stomp-server 1.0.3 → 1.0.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 CHANGED
@@ -77,12 +77,12 @@ import { Stomp } from 'ws-stomp-server';
77
77
 
78
78
  const app = express();
79
79
  app.get('/send', (_, res) => {
80
- Stomp.publish('/topic/test', JSON.stringify({ name: 'hello word!' }));
80
+ Stomp.send('/topic/something', 'payload');
81
81
  res.status(200).json({});
82
82
  });
83
83
  const server = app.listen(8080);
84
84
  Stomp.server(server, '/ws');
85
- Stomp.subscribe('/topic/test', (message) => {
85
+ Stomp.subscribe('/topic/greetings', (message) => {
86
86
  console.log(message.body);
87
87
  });
88
88
  ```
@@ -95,10 +95,10 @@ import { Client } from '@stomp/stompjs';
95
95
  const client = new Client({
96
96
  brokerURL: 'ws://localhost:8080/ws',
97
97
  onConnect: () => {
98
- client.subscribe('/topic/test', (message) => {
98
+ client.publish({ destination: '/topic/greetings', body: 'Hello World!' });
99
+ client.subscribe('/topic/something', (message) => {
99
100
  console.log(message.body);
100
101
  });
101
- client.publish({ destination: '/topic/test', body: 'First Message' });
102
102
  },
103
103
  });
104
104
  client.activate();
package/dist/index.d.ts CHANGED
@@ -35,7 +35,7 @@ declare class Stomp {
35
35
  private constructor();
36
36
  static server(server: Server | Server$1, path: string, authProvider?: AuthProvider): void;
37
37
  private static get;
38
- static publish(destination: string, body: string, headers?: Record<string, string>): void;
38
+ static send(destination: string, body: string, headers?: Record<string, string>): void;
39
39
  static subscribe(destination: string, callback: (frame: StompFrame) => void): void;
40
40
  static unsubscribe(destination: string): void;
41
41
  }
package/dist/index.js CHANGED
@@ -249,7 +249,7 @@ class Stomp {
249
249
  static get() {
250
250
  return Autowired.get(className);
251
251
  }
252
- static publish(destination, body, headers = {}) {
252
+ static send(destination, body, headers = {}) {
253
253
  this.get()?.send(destination, body, headers);
254
254
  }
255
255
  static subscribe(destination, callback) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ws-stomp-server",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "ws-stomp-server",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",