Skip to content

Commit 0f62083

Browse files
author
Vitaliy Stoliarov
committed
remove run_example in auth example
1 parent 9cdf18c commit 0f62083

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

examples/ws2/auth.js

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
'use strict'
22

3-
const runExample = require('../util/run_example')
3+
const dotenv = require('dotenv')
4+
const D = require('debug')
5+
const WSv2 = require('../../lib/transports/ws2')
6+
const debug = D('>')
7+
debug.enabled = true
8+
9+
dotenv.config()
10+
const { API_KEY, API_SECRET } = process.env
11+
12+
async function execute () {
13+
const ws = new WSv2({
14+
apiKey: API_KEY,
15+
apiSecret: API_SECRET
16+
})
17+
ws.on('error', e => debug('WSv2 error: %s', e.message | e))
418

5-
module.exports = runExample({
6-
name: 'ws2-auth',
7-
ws: { env: true } // manually open/auth to show usage
8-
}, async ({ ws, debug }) => {
919
// register a callback for any order snapshot that comes in (account orders)
1020
ws.onOrderSnapshot({}, (orders) => {
1121
debug(`order snapshot: ${JSON.stringify(orders, null, 2)}`)
@@ -18,4 +28,6 @@ module.exports = runExample({
1828
debug('authenticated')
1929

2030
// do something with authenticated ws stream
21-
})
31+
}
32+
33+
execute()

0 commit comments

Comments
 (0)