File tree 1 file changed +15
-6
lines changed
1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
- const runExample = require ( '../util/run_example' )
3
+ const { args : { apiKey, apiSecret } , debug } = require ( '../util/setup' )
4
+ const WSv2 = require ( '../../lib/transports/ws2' )
5
+
6
+ async function execute ( ) {
7
+ const ws = new WSv2 ( {
8
+ apiKey,
9
+ apiSecret,
10
+ transform : true
11
+ } )
12
+ ws . on ( 'error' , e => debug ( 'WSv2 error: %s' , e . message | e ) )
13
+ await ws . open ( )
4
14
5
- module . exports = runExample ( {
6
- name : 'ws2-tickers' ,
7
- ws : { env : true , connect : true , transform : true }
8
- } , async ( { ws, debug } ) => {
9
15
ws . onTicker ( { symbol : 'tETHUSD' } , ( ticker ) => {
10
16
debug ( 'ETH/USD ticker: %j' , ticker . toJS ( ) )
11
17
} )
@@ -16,4 +22,7 @@ module.exports = runExample({
16
22
17
23
await ws . subscribeTicker ( 'tETHUSD' )
18
24
await ws . subscribeTicker ( 'fUSD' )
19
- } )
25
+ await ws . close ( )
26
+ }
27
+
28
+ execute ( )
You can’t perform that action at this time.
0 commit comments