-
Notifications
You must be signed in to change notification settings - Fork 0
/
scla.mjs
38 lines (33 loc) · 953 Bytes
/
scla.mjs
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
import WSC from './src/WWebsocketClient.mjs'
//import WSC from './dist/w-websocket-client.umd.js'
let opt = {
url: 'ws://localhost:9000',
token: '*',
open: function() {
console.log('client nodejs[port:8080]: open')
//send
wsc.send('abc')
//msg
// let msg = {
// token: opt.token,
// _id: 'abc',
// func: 'getFuncs',
// input: null,
// }
// wsc.send(JSON.stringify(msg), function(err) {
// if (err) {
// console.log('client nodejs[port:8080]: send: err', err)
// }
// })
},
close: function() {
console.log('client nodejs[port:8080]: close')
},
message: function(data) {
console.log('client nodejs[port:8080]: message', data)
},
error: function(err) {
console.log('client nodejs[port:8080]: error:', err)
},
}
let wsc = new WSC(opt)