Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6779ee5

Browse files
committed
add close method to Socket
1 parent 118a1aa commit 6779ee5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Socket/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ var mySocket = new Socket();
1919

2020
## Methods
2121

22+
### close
23+
24+
```js
25+
mySocket.close();
26+
```
27+
2228
### onOpen
2329

2430
```js

Socket/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ function Socket() {
1717
EventEmitter.call(this);
1818
var wsUrl = 'wss://ws.blockchain.info/inv';
1919
var socket = new WebSocket(wsUrl);
20+
this.close = socket.close.bind(socket);
2021

2122
this.op = function (op, data) {
2223
var message = JSON.stringify(extend({ op: op }, data || {}));

0 commit comments

Comments
 (0)