-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathtest.ts
53 lines (42 loc) · 1.23 KB
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { Client, MessageCode, SettingType } from './src/api'
import { SCENES_OF } from './src/lib/util/fileRequestUtil'
import { createPacket } from './src/lib/util/messageProtocol'
const client = new Client({
host: '192.168.0.29',
port: 53000
}, {
autoreconnect: true,
logLevel: process.env.DEBUG ? 'debug' : 'info'
})
/**
* Reconnect if the connection is lost and autoreconnect is enabled
* Raised after the Keep-Alive health check expires
*/
client.on('reconnecting', function () {
console.log('evt: Reconnecting to console')
})
client.on('closed', function () {
console.log('evt: Connection closed')
})
client.on('connected', function () {
console.log('evt: Connected')
})
client.on('data', function ({ code, data }) {
//
})
client.on(MessageCode.ParamValue, function (data: SettingType) {
//
})
client.connect().then(() => {
console.log('Connection was established')
// client.hehe().then(j => console.log(j))
// client.sendList('presets/channel').then(j => {
// console.log('Got channel list', j)
// })
// client.sendList('presets/proj').then(j => {
// console.log('Got proj list', j)
// client.sendList(SCENES_OF(j[0].name)).then(j => {
// console.log('Got scene list', j)
// })
// })
})