Skip to content

Commit

Permalink
Minor corrections and details
Browse files Browse the repository at this point in the history
- Inconsistency corrected between conn and bdb at the beginning, while they are the same object
- Asset Creation and Transfer: Cleaned a little useless code that made the end of it not working (returning res.id instead of res... but the (res) arrow function block was an unnecessary step)
- Websocket example: added a precision for the testnet case requiring SSL and port 443
  • Loading branch information
tnguyen42 authored May 22, 2018
1 parent 9163284 commit 80811b8
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ To do so, you need to pass the **app_id and app_key**.

.. code-block:: js
let bdb = new driver.Connection('https://test.bigchaindb.com/api/v1/', {
let conn = new driver.Connection('https://test.bigchaindb.com/api/v1/', {
app_id: 'Get one from testnet.bigchaindb.com',
app_key: 'Get one from testnet.bigchaindb.com'
})
Expand Down Expand Up @@ -365,11 +365,8 @@ Recap: Asset Creation & Transfer
// Post with commit so transaction is validated and included in a block
return conn.postTransactionCommit(txTransferBobSigned)
})
.then(res => {
console.log('Response from BDB server:', res)
return res.id
})
.then(tx => {
console.log('Response from BDB server:', tx)
console.log('Is Bob the owner?', tx['outputs'][0]['public_keys'][0] == bob.publicKey)
console.log('Was Alice the previous owner?', tx['inputs'][0]['owners_before'][0] == alice.publicKey )
})
Expand Down Expand Up @@ -408,7 +405,7 @@ Websocket Event Stream API Usage
--------------------------------

The Event Stream API enables new ways to interact with BigchainDB, making it possible for your application to subscribe to all newly–confirmed transactions that are happening in the system.
Below piece of code can be opened in your web browser. It will connect to your websocket (change it at ``var wsUri``). This web page will display all validated transactions.
Below piece of code can be opened in your web browser. It will connect to your websocket (if you are using the testnet, redefine ``var wsUri ='wss://test.bigchaindb.com:443/api/v1/streams/valid_transactions'``). This web page will display all validated transactions.

.. code-block:: html

Expand Down

0 comments on commit 80811b8

Please sign in to comment.