mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Update endpoints and docs
This commit is contained in:
parent
aeb8827e30
commit
be3f62dd10
@ -28,4 +28,4 @@ def base_url():
|
||||
|
||||
def base_ws_uri():
|
||||
"""Base websocket uri."""
|
||||
return 'ws://{host}:{port}/'.format(**config['wsserver'])
|
||||
return 'ws://{host}:{port}'.format(**config['wsserver'])
|
||||
|
@ -6,6 +6,7 @@ from flask_restful import Resource
|
||||
import bigchaindb
|
||||
from bigchaindb.web.views.base import base_url, base_ws_uri
|
||||
from bigchaindb import version
|
||||
from bigchaindb.web.websocket_server import EVENTS_ENDPOINT
|
||||
|
||||
|
||||
class RootIndex(Resource):
|
||||
@ -30,7 +31,7 @@ class RootIndex(Resource):
|
||||
class ApiV1Index(Resource):
|
||||
def get(self):
|
||||
api_root = base_url() + 'api/v1/'
|
||||
websocket_root = base_ws_uri() + 'api/v1/'
|
||||
websocket_root = base_ws_uri() + EVENTS_ENDPOINT
|
||||
docs_url = [
|
||||
'https://docs.bigchaindb.com/projects/server/en/v',
|
||||
version.__version__,
|
||||
@ -43,6 +44,6 @@ class ApiV1Index(Resource):
|
||||
'statuses': api_root + 'statuses/',
|
||||
'transactions': api_root + 'transactions/',
|
||||
# TODO: The version should probably not be hardcoded
|
||||
'streams_v1': websocket_root + 'streams/',
|
||||
'streams_v1': websocket_root,
|
||||
},
|
||||
})
|
||||
|
@ -26,7 +26,7 @@ from bigchaindb.events import EventTypes
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
POISON_PILL = 'POISON_PILL'
|
||||
EVENTS_ENDPOINT = '/api/v1/streams/'
|
||||
EVENTS_ENDPOINT = '/api/v1/streams/valid_tx'
|
||||
|
||||
|
||||
def _put_into_capped_queue(queue, value):
|
||||
|
@ -1,6 +1,11 @@
|
||||
The WebSocket Event Stream API
|
||||
==============================
|
||||
|
||||
.. important::
|
||||
The WebSocket Event Stream runs on a different port than the Web API. The
|
||||
default port for the Web API is `9984`, while the one for the Event Stream
|
||||
is `9985`.
|
||||
|
||||
BigchainDB provides real-time event streams over the WebSocket protocol with
|
||||
the Event Stream API.
|
||||
|
||||
@ -25,7 +30,7 @@ response contains a ``streams_<version>`` property in ``_links``::
|
||||
|
||||
{
|
||||
"_links": {
|
||||
"streams_v1": "ws://example.com:9984/api/v1/streams/"
|
||||
"streams_v1": "ws://example.com:9985/api/v1/streams/"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,6 +144,8 @@ def test_autoconfigure_read_both_from_file_and_env(monkeypatch, request):
|
||||
DATABASE_PORT = 4242
|
||||
DATABASE_BACKEND = request.config.getoption('--database-backend')
|
||||
SERVER_BIND = '1.2.3.4:56'
|
||||
WSSERVER_HOST = '1.2.3.4'
|
||||
WSSERVER_PORT = 57
|
||||
KEYRING = 'pubkey_0:pubkey_1:pubkey_2'
|
||||
|
||||
file_config = {
|
||||
@ -157,6 +159,8 @@ def test_autoconfigure_read_both_from_file_and_env(monkeypatch, request):
|
||||
'BIGCHAINDB_DATABASE_PORT': str(DATABASE_PORT),
|
||||
'BIGCHAINDB_DATABASE_BACKEND': DATABASE_BACKEND,
|
||||
'BIGCHAINDB_SERVER_BIND': SERVER_BIND,
|
||||
'BIGCHAINDB_WSSERVER_HOST': WSSERVER_HOST,
|
||||
'BIGCHAINDB_WSSERVER_PORT': WSSERVER_PORT,
|
||||
'BIGCHAINDB_KEYRING': KEYRING})
|
||||
|
||||
import bigchaindb
|
||||
@ -198,6 +202,10 @@ def test_autoconfigure_read_both_from_file_and_env(monkeypatch, request):
|
||||
'workers': None,
|
||||
'threads': None,
|
||||
},
|
||||
'wsserver': {
|
||||
'host': WSSERVER_HOST,
|
||||
'port': WSSERVER_PORT,
|
||||
},
|
||||
'database': database,
|
||||
'keypair': {
|
||||
'public': None,
|
||||
|
@ -31,6 +31,6 @@ def test_api_v1_endpoint(client):
|
||||
'self': 'http://localhost/api/v1/',
|
||||
'statuses': 'http://localhost/api/v1/statuses/',
|
||||
'transactions': 'http://localhost/api/v1/transactions/',
|
||||
'streams_v1': 'ws://localhost:9985/api/v1/streams/',
|
||||
'streams_v1': 'ws://localhost:9985/api/v1/streams/valid_tx',
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user