added status
This commit is contained in:
@@ -45,13 +45,16 @@ const nodeInit: NodeInitializer = (RED): void => {
|
||||
await client.reconnect(-1, 1000)
|
||||
}else{
|
||||
// TODO: Emit error
|
||||
this.emit("error")
|
||||
}
|
||||
}else{
|
||||
this.emit("disconnect")
|
||||
}
|
||||
})
|
||||
|
||||
this.emit("connected")
|
||||
return client
|
||||
}catch(err){
|
||||
// TODO: handle error
|
||||
this.emit("error")
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,19 @@ const nodeInit: NodeInitializer = (RED): void => {
|
||||
|
||||
const ts3Config = RED.nodes.getNode(config.configid) as Ts3ConfigNode
|
||||
|
||||
// HACK: ts3Config.on("connected") would not work because i dont know how to use typescript
|
||||
ts3Config.addListener("connected",()=>{
|
||||
this.status({fill:"green",shape:"dot",text:"Connected"})
|
||||
})
|
||||
|
||||
ts3Config.addListener("disconnect",()=>{
|
||||
this.status({fill:"grey",shape:"dot",text:"not conncted"})
|
||||
})
|
||||
|
||||
ts3Config.addListener("error",()=>{
|
||||
this.status({fill:"red",shape:"dot",text:"Error"})
|
||||
})
|
||||
|
||||
this.on("input", async (msg,send,done) => {
|
||||
const client = await ts3Config.getConnection()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user