shinobi-tensorflow.js : add Websocket Disconnect when checkStartTime fails

fix-non-showing-inputs
Moe Alam 2020-11-19 16:26:23 -08:00
parent ababb20c22
commit d4513c4c4f
2 changed files with 9 additions and 0 deletions

View File

@ -331,6 +331,9 @@ module.exports = function(__dirname, config){
delete(s.connectedClients[cn.id])
})
});
s.disconnectWebSocket = () => {
}
}else{
//start plugin as client
var retryConnection = 0
@ -343,6 +346,11 @@ module.exports = function(__dirname, config){
var io = require('socket.io-client')('ws://'+config.host+':'+config.port,{
transports: ['websocket']
});
s.disconnectWebSocket = () => {
allowDisconnect = true
io.disconnect()
console.log('Disconnected Websocket')
}
const onDisconnect = (err) => {
clearTimeout(clearRetryConnectionTimeout)
if(io.connected){

View File

@ -30,6 +30,7 @@ const {
} = require('../pluginCheck.js')
if(!checkStartTime()){
console.log(haltMessage,new Date())
s.disconnectWebSocket()
return
}
setStartTime()