mirror of
https://github.com/LemmyNet/lemmy-docs.git
synced 2024-12-22 19:01:24 +00:00
Merge pull request #24 from shilangyu/patch-1
Add data field in websocket example
This commit is contained in:
commit
60f6522304
1 changed files with 3 additions and 2 deletions
|
@ -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`
|
||||
|
||||
A simple test command:
|
||||
`{"op": "ListCategories"}`
|
||||
`{"op": "ListCategories", "data": {}}`
|
||||
|
||||
### Testing with the WebSocket JavaScript API
|
||||
|
||||
|
@ -175,7 +175,8 @@ var ws = new WebSocket("ws://" + host + "/api/v2/ws");
|
|||
ws.onopen = function () {
|
||||
console.log("Connection succeed!");
|
||||
ws.send(JSON.stringify({
|
||||
op: "ListCategories"
|
||||
op: "ListCategories",
|
||||
data: {}
|
||||
}));
|
||||
};
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue