@rpcbase/client 0.218.0 → 0.219.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/rts/rts.js +17 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/client",
3
- "version": "0.218.0",
3
+ "version": "0.219.0",
4
4
  "scripts": {
5
5
  "build": "../../node_modules/.bin/wireit",
6
6
  "test": "../../node_modules/.bin/wireit"
package/rts/rts.js CHANGED
@@ -218,3 +218,20 @@ export const register_query = (model_name, query, _options, _callback) => {
218
218
  }
219
219
  }
220
220
  }
221
+
222
+
223
+ export const send_message = (message, payload) => {
224
+ if (!_socket) {
225
+ console.error("attempting to send message without socket", {message, payload})
226
+ return
227
+ }
228
+
229
+ _socket.emit(message, payload)
230
+ }
231
+
232
+
233
+ export const on_message = (message, callback) => {
234
+ if (!_socket) {
235
+ throw new Error("registering socket message listener without socket")
236
+ }
237
+ }