[headless] make events related to adding contacts available via websocket

This commit is contained in:
Torsten Grote
2019-05-14 16:15:47 -03:00
parent c6211be488
commit 3770a9f217
8 changed files with 190 additions and 19 deletions

View File

@@ -274,8 +274,51 @@ it will send a JSON object to connected websocket clients:
Note that the JSON object in `data` is exactly what the REST API returns
when listing private messages.
# TODO
### A new contact was added remotely
* PendingContactStateChangedEvent
* PendingContactRemovedEvent
* ContactAddedRemotelyEvent
When the Briar peer adds a new contact remotely,
it will send a JSON object representing the new contact to connected websocket clients:
```json
{
"data": {
"author": {
"formatVersion": 1,
"id": "y1wkIzAimAbYoCGgWxkWlr6vnq1F8t1QRA/UMPgI0E0=",
"name": "Test",
"publicKey": "BDu6h1S02bF4W6rgoZfZ6BMjTj/9S9hNN7EQoV05qUo="
},
"contactId": 1,
"verified": true
},
"name": "ContactAddedRemotelyEvent",
"type": "event"
}
```
### A pending contact changed its state
```json
{
"data": {
"pendingContactId":"YqKjsczCuxScXohb5+RAYtFEwK71icoB4ldztV2gh7M=",
"state":"waiting_for_connection"
},
"name": "PendingContactStateChangedEvent",
"type": "event"
}
```
For a list of valid states, please see the section on adding contacts above.
### A pending contact was removed
```json
{
"data": {
"pendingContactId": "YqKjsczCuxScXohb5+RAYtFEwK71icoB4ldztV2gh7M="
},
"name": "PendingContactRemovedEvent",
"type": "event"
}
```