From f1a9650679be288c76664cdf0ad51ff2e3dfb626 Mon Sep 17 00:00:00 2001 From: Rodolphe Marques Date: Wed, 14 Jun 2017 10:36:23 +0200 Subject: [PATCH] Consistent naming on the events api --- bigchaindb/web/websocket_server.py | 4 ++-- .../server/source/websocket-event-stream-api.rst | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bigchaindb/web/websocket_server.py b/bigchaindb/web/websocket_server.py index 0aa51ecb..42118166 100644 --- a/bigchaindb/web/websocket_server.py +++ b/bigchaindb/web/websocket_server.py @@ -26,7 +26,7 @@ from bigchaindb.events import EventTypes logger = logging.getLogger(__name__) POISON_PILL = 'POISON_PILL' -EVENTS_ENDPOINT = '/api/v1/streams/valid_tx' +EVENTS_ENDPOINT = '/api/v1/streams/valid_transactions' def _multiprocessing_to_asyncio(in_queue, out_queue, loop): @@ -91,7 +91,7 @@ class Dispatcher: asset_id = tx['id'] if tx['operation'] == 'CREATE' else tx['asset']['id'] data = {'block_id': block['id'], 'asset_id': asset_id, - 'tx_id': tx['id']} + 'transaction_id': tx['id']} str_buffer.append(json.dumps(data)) for _, websocket in self.subscribers.items(): diff --git a/docs/server/source/websocket-event-stream-api.rst b/docs/server/source/websocket-event-stream-api.rst index efeb4d82..0000107b 100644 --- a/docs/server/source/websocket-event-stream-api.rst +++ b/docs/server/source/websocket-event-stream-api.rst @@ -32,7 +32,7 @@ response contains a ``streams`` property: { ..., - "streams": "ws://example.com:9985/api/v1/streams/valid_tx", + "streams": "ws://example.com:9985/api/v1/streams/valid_transactions", ... } @@ -56,8 +56,8 @@ BigchainDB node will be ignored. Streams will always be under the WebSocket protocol (so ``ws://`` or ``wss://``) and accessible as extensions to the ``/api/v/streams/`` API root URL (for example, `validated transactions <#valid-transactions>`_ -would be accessible under ``/api/v1/streams/valid_tx``). If you're running your -own BigchainDB instance and need help determining its root URL, +would be accessible under ``/api/v1/streams/valid_transactions``). If you're +running your own BigchainDB instance and need help determining its root URL, then see the page titled :ref:`Determining the API Root URL`. All messages sent in a stream are in the JSON format. @@ -77,7 +77,7 @@ All messages sent in a stream are in the JSON format. Valid Transactions ~~~~~~~~~~~~~~~~~~ -``/valid_tx`` +``/valid_transactions`` Streams an event for any newly validated transactions. Message bodies contain the transaction's ID, associated asset ID, and containing block's ID. @@ -87,7 +87,7 @@ Example message: .. code:: JSON { - "tx_id": "", + "transaction_id": "", "asset_id": "", "block_id": "" } @@ -98,6 +98,6 @@ Example message: Transactions in BigchainDB are validated in batches ("blocks") and will, therefore, be streamed in batches. Each block can contain up to a 1000 transactions, ordered by the time at which they were included in the block. - The ``/valid_tx`` stream will send these transactions in the same order - that the block stored them in, but this does **NOT** guarantee that you - will recieve the events in that same order. + The ``/valid_transactions`` stream will send these transactions in the same + order that the block stored them in, but this does **NOT** guarantee that + you will recieve the events in that same order.