From e04a8f20b44eec98921b6b85ac4cedb4fa398aa6 Mon Sep 17 00:00:00 2001 From: Maltese Date: Fri, 22 Aug 2014 10:29:24 +0200 Subject: [PATCH] Improved documentation about socket.io API. --- README.md | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index abf3c08..f61da08 100644 --- a/README.md +++ b/README.md @@ -284,13 +284,11 @@ Where "xxx" can be: * getLastBlockHash ## Web Socket API -The web socket API is served using [socket.io](http://socket.io) at: -``` - /socket.io/1/ -``` +The web socket API is served using [socket.io](http://socket.io). -Bitcoin network events published are: -'tx': new transaction received from network. Data will be a app/models/Transaction object. +The following are the events published by insight: + +'tx': new transaction received from network. This event is published in the 'inv' room. Data will be a app/models/Transaction object. Sample output: ``` { @@ -301,7 +299,7 @@ Sample output: ``` -'block': new block received from network. Data will be a app/models/Block object. +'block': new block received from network. This event is published in the 'inv' room. Data will be a app/models/Block object. Sample output: ``` { @@ -311,7 +309,9 @@ Sample output: } ``` -'sync': every 1% increment on the sync task, this event will be triggered. +'': new transaction concerning received from network. This event is published in the '' room. + +'status': every 1% increment on the sync task, this event will be triggered. This event is published in the 'sync' room. Sample output: ``` @@ -327,6 +327,31 @@ Sample output: } ``` +### Example Usage + +The following html page connects to the socket.io insight API and listens for new transactions. + +html +``` + + + + + + +``` ## License (The MIT License)