added status
This commit is contained in:
@@ -45,13 +45,16 @@ const nodeInit: NodeInitializer = (RED): void => {
|
|||||||
await client.reconnect(-1, 1000)
|
await client.reconnect(-1, 1000)
|
||||||
}else{
|
}else{
|
||||||
// TODO: Emit error
|
// TODO: Emit error
|
||||||
|
this.emit("error")
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
this.emit("disconnect")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
this.emit("connected")
|
||||||
return client
|
return client
|
||||||
}catch(err){
|
}catch(err){
|
||||||
// TODO: handle error
|
this.emit("error")
|
||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,19 @@ const nodeInit: NodeInitializer = (RED): void => {
|
|||||||
|
|
||||||
const ts3Config = RED.nodes.getNode(config.configid) as Ts3ConfigNode
|
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) => {
|
this.on("input", async (msg,send,done) => {
|
||||||
const client = await ts3Config.getConnection()
|
const client = await ts3Config.getConnection()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user