1
0
Fork 0
mirror of https://github.com/bitcoin/bips.git synced 2025-03-04 03:03:53 +01:00

Add example pub/sub commands

This commit is contained in:
Ben van Hartingsveldt 2024-05-10 23:49:57 +02:00
parent 19cf447939
commit 6e26691db9
No known key found for this signature in database
GPG key ID: 261AA214130CE7AB

View file

@ -273,18 +273,83 @@ Ask the server to run a synchronous command for a specific amount of seconds.
* Method name: <code>synchronous</code>
{|
! <ins>[Request]</ins>
! Type
! Example
! Description
|-
! Method
| colspan="3" | <code>example.synchronous</code>
|-
! Params [0] (<code>how_long</code>)
| <code>int</code> (or a <code>string</code> or a <code>float</code> that can be casted to an <code>int</code>)
| <code>123</code>
| The time to run.
|-
! <ins>[Response]</ins>
! Type
! Example
! Description
|-
! Result
| <code>string</code>
| <code>Request finished in 123 seconds</code>
| A string that tells that the command has finished running.
|}
====Method: Throw Exception====
Ask the server throw exception.
* Method name: <code>throw_exception</code>
{|
! <ins>[Request]</ins>
! Type
! Example
! Description
|-
! Method
| colspan="3" | <code>example.throw_exception</code>
|-
! <ins>[Response]</ins>
! Type
! Example
! Description
|-
! Error
| <code>object</code>
| <code>{"code":-1,"data":"Some traceback","message":"Some error"}</code>
| The error object.
|}
====Method: Throw Signed Exception====
Ask the server throw signed exception.
Ask the server throw exception in a signed JSON-RPC object.
* Method name: <code>throw_signed_exception</code>
{|
! <ins>[Request]</ins>
! Type
! Example
! Description
|-
! Method
| colspan="3" | <code>example.throw_exception</code>
|-
! <ins>[Response]</ins>
! Type
! Example
! Description
|-
! Error
| <code>object</code>
| <code>{"code":-1,"data":"Some traceback","message":"Some error"}</code>
| The error object.
|}
===Service: Example Publish-Subscribe===
This service is an example service. It doesn't have any other purpose than testing.
@ -298,18 +363,83 @@ Subscribe on an event.
* Method name: <code>subscribe</code>
{|
! <ins>[Request]</ins>
! Type
! Example
! Description
|-
! Method
| colspan="3" | <code>example.pubsub.subscribe</code>
|-
! Params [0] (<code>period</code>)
| <code>int</code>
| <code>12</code>
| Period to wait for next emission.
|-
! <ins>[Response]</ins>
! Type
! Example
! Description
|-
! Result
| ...
| ...
| ...
|}
====Method: Time Event====
The time event that gets emitted.
* Method name: <code>time_event</code>
{|
! <ins>[Request]</ins>
! Type
! Example
! Description
|-
! Method
| colspan="3" | <code>example.pubsub.time_event</code>
|-
! Params [0]
| ...
| ...
| ...
|}
====Method: Unsubscribe====
Unsubscribe from an event.
* Method name: <code>unsubscribe</code>
{|
! <ins>[Request]</ins>
! Type
! Example
! Description
|-
! Method
| colspan="3" | <code>example.pubsub.unsubscribe</code>
|-
! Params [0] (<code>subscription_key</code>)
| <code>string</code>
| <code>some-subscription-key</code>
| The subscription key of the event subscription.
|-
! <ins>[Response]</ins>
! Type
! Example
! Description
|-
! Result
| <code>string</code>
| <code>some-subscription-key</code>
| The subscription key of the event subscription.
|}
===Service: Server===
* Service name: <code>server</code>