Merge pull request #24 from shilangyu/patch-1

Add data field in websocket example
This commit is contained in:
Dessalines 2021-02-10 18:13:01 -05:00 committed by GitHub
commit 60f6522304
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -164,7 +164,7 @@ To receive websocket messages, you must join a room / context. The four availabl
`websocat ws://127.0.0.1:8536/api/v2/ws -nt` `websocat ws://127.0.0.1:8536/api/v2/ws -nt`
A simple test command: A simple test command:
`{"op": "ListCategories"}` `{"op": "ListCategories", "data": {}}`
### Testing with the WebSocket JavaScript API ### Testing with the WebSocket JavaScript API
@ -175,7 +175,8 @@ var ws = new WebSocket("ws://" + host + "/api/v2/ws");
ws.onopen = function () { ws.onopen = function () {
console.log("Connection succeed!"); console.log("Connection succeed!");
ws.send(JSON.stringify({ ws.send(JSON.stringify({
op: "ListCategories" op: "ListCategories",
data: {}
})); }));
}; };
``` ```