File tree 1 file changed +16
-8
lines changed
1 file changed +16
-8
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
+ autoReconnect : true
11
+ } )
12
+ ws . on ( 'error' , e => debug ( 'WSv2 error: %s' , e . message | e ) )
13
+ await ws . open ( )
14
+ await ws . auth ( )
4
15
5
- module . exports = runExample ( {
6
- name : 'ws2-info-events' ,
7
- ws : {
8
- env : true , connect : true , auth : true , autoReconnect : true
9
- }
10
- } , async ( { ws, debug } ) => {
11
16
ws . onMaintenanceStart ( ( ) => {
12
17
debug ( 'info: maintenance period started' )
13
18
// pause activity untill further notice
@@ -22,4 +27,7 @@ module.exports = runExample({
22
27
debug ( 'info: bitfinex ws server restarted' )
23
28
// await ws.reconnect() // if not using autoReconnect
24
29
} )
25
- } )
30
+ await ws . close ( )
31
+ }
32
+
33
+ execute ( )
You can’t perform that action at this time.
0 commit comments