mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-05-05 09:17:51 +00:00
Remove log spam
This commit is contained in:
parent
85af2e82b7
commit
f441406dd5
@ -7,20 +7,16 @@ let closeGracefully = false
|
|||||||
let isCalled = false
|
let isCalled = false
|
||||||
let retryOnClose = false
|
let retryOnClose = false
|
||||||
let blockFirstCall = true
|
let blockFirstCall = true
|
||||||
|
|
||||||
let nodeStatusSocketObject
|
let nodeStatusSocketObject
|
||||||
let nodeStatusSocketTimeout
|
let nodeStatusSocketTimeout
|
||||||
let nodeStatusSocketcloseGracefully = false
|
let nodeStatusSocketcloseGracefully = false
|
||||||
let nodeStatusCount = 0
|
let nodeStatusCount = 0
|
||||||
let nodeStatusRetryOnClose = false
|
let nodeStatusRetryOnClose = false
|
||||||
let nodeStateCall = false
|
let nodeStateCall = false
|
||||||
|
|
||||||
let isLoggedIn = false
|
let isLoggedIn = false
|
||||||
|
|
||||||
let oldAccountInfo
|
let oldAccountInfo
|
||||||
|
|
||||||
parentEpml.subscribe('logged_in', loggedIn => {
|
parentEpml.subscribe('logged_in', loggedIn => {
|
||||||
|
|
||||||
if (loggedIn === 'true') {
|
if (loggedIn === 'true') {
|
||||||
isLoggedIn = true
|
isLoggedIn = true
|
||||||
} else {
|
} else {
|
||||||
@ -29,35 +25,28 @@ parentEpml.subscribe('logged_in', loggedIn => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const setAccountInfo = async (addr) => {
|
const setAccountInfo = async (addr) => {
|
||||||
|
|
||||||
const names = await parentEpml.request('apiCall', {
|
const names = await parentEpml.request('apiCall', {
|
||||||
url: `/names/address/${addr}`
|
url: `/names/address/${addr}`
|
||||||
})
|
})
|
||||||
const addressInfo = await parentEpml.request('apiCall', {
|
const addressInfo = await parentEpml.request('apiCall', {
|
||||||
url: `/addresses/${addr}`
|
url: `/addresses/${addr}`
|
||||||
})
|
})
|
||||||
|
|
||||||
let accountInfo = {
|
let accountInfo = {
|
||||||
names: names,
|
names: names,
|
||||||
addressInfo: addressInfo
|
addressInfo: addressInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.parent._.isEqual(oldAccountInfo, accountInfo) === true) {
|
if (window.parent._.isEqual(oldAccountInfo, accountInfo) === true) {
|
||||||
|
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
parentEpml.request('setAccountInfo', accountInfo)
|
parentEpml.request('setAccountInfo', accountInfo)
|
||||||
oldAccountInfo = accountInfo
|
oldAccountInfo = accountInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const doNodeInfo = async () => {
|
const doNodeInfo = async () => {
|
||||||
|
|
||||||
const nodeInfo = await parentEpml.request('apiCall', {
|
const nodeInfo = await parentEpml.request('apiCall', {
|
||||||
url: '/admin/info'
|
url: '/admin/info'
|
||||||
})
|
})
|
||||||
|
|
||||||
parentEpml.request('updateNodeInfo', nodeInfo)
|
parentEpml.request('updateNodeInfo', nodeInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,71 +54,57 @@ let initStateCount = 0
|
|||||||
let oldState
|
let oldState
|
||||||
|
|
||||||
const closeSockets = () => {
|
const closeSockets = () => {
|
||||||
|
socketObject.close()
|
||||||
socketObject.close();
|
|
||||||
closeGracefully = true
|
closeGracefully = true
|
||||||
|
nodeStatusSocketObject.close()
|
||||||
nodeStatusSocketObject.close();
|
|
||||||
nodeStatusSocketcloseGracefully = true
|
nodeStatusSocketcloseGracefully = true
|
||||||
}
|
}
|
||||||
|
|
||||||
export const startConfigWatcher = () => {
|
export const startConfigWatcher = () => {
|
||||||
|
|
||||||
parentEpml.ready().then(() => {
|
parentEpml.ready().then(() => {
|
||||||
parentEpml.subscribe('node_config', c => {
|
parentEpml.subscribe('node_config', c => {
|
||||||
|
|
||||||
if (initStateCount === 0) {
|
if (initStateCount === 0) {
|
||||||
let _oldState = JSON.parse(c)
|
let _oldState = JSON.parse(c)
|
||||||
oldState = { node: _oldState.node, knownNodes: _oldState.knownNodes }
|
oldState = { node: _oldState.node, knownNodes: _oldState.knownNodes }
|
||||||
initStateCount = initStateCount + 1
|
initStateCount = initStateCount + 1
|
||||||
|
|
||||||
nodeStateCall = true
|
nodeStateCall = true
|
||||||
isCalled = true
|
isCalled = true
|
||||||
socketObject !== undefined ? closeSockets() : undefined;
|
socketObject !== undefined ? closeSockets() : undefined
|
||||||
nodeStatusSocketObject !== undefined ? closeSockets() : undefined;
|
nodeStatusSocketObject !== undefined ? closeSockets() : undefined
|
||||||
initNodeStatusCall(oldState)
|
initNodeStatusCall(oldState)
|
||||||
pingactiveBlockSocket()
|
pingactiveBlockSocket()
|
||||||
|
|
||||||
// Call doNodeInfo
|
// Call doNodeInfo
|
||||||
doNodeInfo()
|
doNodeInfo()
|
||||||
}
|
}
|
||||||
|
let _newState = JSON.parse(c)
|
||||||
let _newState = JSON.parse(c);
|
|
||||||
let newState = { node: _newState.node, knownNodes: _newState.knownNodes }
|
let newState = { node: _newState.node, knownNodes: _newState.knownNodes }
|
||||||
|
|
||||||
if (window.parent._.isEqual(oldState, newState) === true) {
|
if (window.parent._.isEqual(oldState, newState) === true) {
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
oldState = newState
|
oldState = newState
|
||||||
nodeStateCall = true
|
nodeStateCall = true
|
||||||
isCalled = true
|
isCalled = true
|
||||||
socketObject !== undefined ? closeSockets() : undefined;
|
socketObject !== undefined ? closeSockets() : undefined
|
||||||
nodeStatusSocketObject !== undefined ? closeSockets() : undefined;
|
nodeStatusSocketObject !== undefined ? closeSockets() : undefined
|
||||||
initNodeStatusCall(newState)
|
initNodeStatusCall(newState)
|
||||||
pingactiveBlockSocket()
|
pingactiveBlockSocket()
|
||||||
|
|
||||||
// Call doNodeInfo
|
// Call doNodeInfo
|
||||||
doNodeInfo()
|
doNodeInfo()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
parentEpml.imReady()
|
parentEpml.imReady()
|
||||||
}
|
}
|
||||||
|
|
||||||
const processBlock = (blockObject) => {
|
const processBlock = (blockObject) => {
|
||||||
|
|
||||||
parentEpml.request('updateBlockInfo', blockObject)
|
parentEpml.request('updateBlockInfo', blockObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
const doNodeStatus = async (nodeStatusObject) => {
|
const doNodeStatus = async (nodeStatusObject) => {
|
||||||
|
|
||||||
parentEpml.request('updateNodeStatus', nodeStatusObject)
|
parentEpml.request('updateNodeStatus', nodeStatusObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const initNodeStatusCall = (nodeConfig) => {
|
const initNodeStatusCall = (nodeConfig) => {
|
||||||
|
|
||||||
if (nodeConfig.node == 0) {
|
if (nodeConfig.node == 0) {
|
||||||
pingNodeStatusSocket()
|
pingNodeStatusSocket()
|
||||||
} else if (nodeConfig.node == 1) {
|
} else if (nodeConfig.node == 1) {
|
||||||
@ -143,193 +118,131 @@ const initNodeStatusCall = (nodeConfig) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const initBlockSocket = () => {
|
const initBlockSocket = () => {
|
||||||
|
|
||||||
let myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
let myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
let nodeUrl = myNode.domain + ":" + myNode.port
|
let nodeUrl = myNode.domain + ":" + myNode.port
|
||||||
|
|
||||||
let activeBlockSocketLink
|
let activeBlockSocketLink
|
||||||
|
|
||||||
if (window.parent.location.protocol === "https:") {
|
if (window.parent.location.protocol === "https:") {
|
||||||
|
activeBlockSocketLink = `wss://${nodeUrl}/websockets/blocks`
|
||||||
activeBlockSocketLink = `wss://${nodeUrl}/websockets/blocks`;
|
|
||||||
} else {
|
} else {
|
||||||
|
activeBlockSocketLink = `ws://${nodeUrl}/websockets/blocks`
|
||||||
activeBlockSocketLink = `ws://${nodeUrl}/websockets/blocks`;
|
|
||||||
}
|
}
|
||||||
|
const activeBlockSocket = new WebSocket(activeBlockSocketLink)
|
||||||
const activeBlockSocket = new WebSocket(activeBlockSocketLink);
|
|
||||||
|
|
||||||
// Open Connection
|
// Open Connection
|
||||||
activeBlockSocket.onopen = (e) => {
|
activeBlockSocket.onopen = (e) => {
|
||||||
|
|
||||||
console.log(`[SOCKET-BLOCKS]: Connected.`);
|
|
||||||
closeGracefully = false
|
closeGracefully = false
|
||||||
socketObject = activeBlockSocket
|
socketObject = activeBlockSocket
|
||||||
|
|
||||||
initial = initial + 1
|
initial = initial + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Message Event
|
// Message Event
|
||||||
activeBlockSocket.onmessage = (e) => {
|
activeBlockSocket.onmessage = (e) => {
|
||||||
|
processBlock(JSON.parse(e.data))
|
||||||
processBlock(JSON.parse(e.data));
|
|
||||||
|
|
||||||
if (isLoggedIn) {
|
if (isLoggedIn) {
|
||||||
|
|
||||||
// Call Set Account Info...
|
// Call Set Account Info...
|
||||||
setAccountInfo(window.parent.reduxStore.getState().app.selectedAddress.address)
|
setAccountInfo(window.parent.reduxStore.getState().app.selectedAddress.address)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Closed Event
|
// Closed Event
|
||||||
activeBlockSocket.onclose = () => {
|
activeBlockSocket.onclose = () => {
|
||||||
|
processBlock({})
|
||||||
console.log(`[SOCKET-BLOCKS]: CLOSED`);
|
|
||||||
|
|
||||||
processBlock({});
|
|
||||||
blockFirstCall = true
|
blockFirstCall = true
|
||||||
clearInterval(activeBlockSocketTimeout)
|
clearInterval(activeBlockSocketTimeout)
|
||||||
|
|
||||||
if (closeGracefully === false && initial <= 52) {
|
if (closeGracefully === false && initial <= 52) {
|
||||||
|
|
||||||
if (initial <= 52) {
|
if (initial <= 52) {
|
||||||
|
|
||||||
retryOnClose = true
|
retryOnClose = true
|
||||||
setTimeout(pingactiveBlockSocket, 10000)
|
setTimeout(pingactiveBlockSocket, 10000)
|
||||||
initial = initial + 1
|
initial = initial + 1
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// ... Stop retrying...
|
// ... Stop retrying...
|
||||||
retryOnClose = false
|
retryOnClose = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error Event
|
// Error Event
|
||||||
activeBlockSocket.onerror = (e) => {
|
activeBlockSocket.onerror = (e) => {
|
||||||
|
|
||||||
console.log(`[SOCKET-BLOCKS]: ${e.type}`);
|
|
||||||
blockFirstCall = true
|
blockFirstCall = true
|
||||||
processBlock({});
|
processBlock({})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockFirstCall) {
|
if (blockFirstCall) {
|
||||||
|
|
||||||
parentEpml.request('apiCall', {
|
parentEpml.request('apiCall', {
|
||||||
url: '/blocks/last'
|
url: '/blocks/last'
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
|
||||||
processBlock(res)
|
processBlock(res)
|
||||||
blockFirstCall = false
|
blockFirstCall = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const pingactiveBlockSocket = () => {
|
const pingactiveBlockSocket = () => {
|
||||||
|
|
||||||
if (isCalled) {
|
if (isCalled) {
|
||||||
|
|
||||||
isCalled = false
|
isCalled = false
|
||||||
|
|
||||||
initBlockSocket()
|
initBlockSocket()
|
||||||
activeBlockSocketTimeout = setTimeout(pingactiveBlockSocket, 295000)
|
activeBlockSocketTimeout = setTimeout(pingactiveBlockSocket, 295000)
|
||||||
} else if (retryOnClose) {
|
} else if (retryOnClose) {
|
||||||
|
|
||||||
retryOnClose = false
|
retryOnClose = false
|
||||||
clearTimeout(activeBlockSocketTimeout)
|
clearTimeout(activeBlockSocketTimeout)
|
||||||
initBlockSocket()
|
initBlockSocket()
|
||||||
isCalled = true
|
isCalled = true
|
||||||
activeBlockSocketTimeout = setTimeout(pingactiveBlockSocket, 295000)
|
activeBlockSocketTimeout = setTimeout(pingactiveBlockSocket, 295000)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
socketObject.send("non-integer ping")
|
socketObject.send("non-integer ping")
|
||||||
activeBlockSocketTimeout = setTimeout(pingactiveBlockSocket, 295000)
|
activeBlockSocketTimeout = setTimeout(pingactiveBlockSocket, 295000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const initNodeStatusSocket = () => {
|
const initNodeStatusSocket = () => {
|
||||||
|
|
||||||
let myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
let myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
let nodeUrl = myNode.domain + ":" + myNode.port
|
let nodeUrl = myNode.domain + ":" + myNode.port
|
||||||
|
|
||||||
let activeNodeStatusSocketLink
|
let activeNodeStatusSocketLink
|
||||||
|
|
||||||
if (window.parent.location.protocol === "https:") {
|
if (window.parent.location.protocol === "https:") {
|
||||||
|
activeNodeStatusSocketLink = `wss://${nodeUrl}/websockets/admin/status`
|
||||||
activeNodeStatusSocketLink = `wss://${nodeUrl}/websockets/admin/status`;
|
|
||||||
} else {
|
} else {
|
||||||
|
activeNodeStatusSocketLink = `ws://${nodeUrl}/websockets/admin/status`
|
||||||
activeNodeStatusSocketLink = `ws://${nodeUrl}/websockets/admin/status`;
|
|
||||||
}
|
}
|
||||||
|
const activeNodeStatusSocket = new WebSocket(activeNodeStatusSocketLink)
|
||||||
const activeNodeStatusSocket = new WebSocket(activeNodeStatusSocketLink);
|
|
||||||
|
|
||||||
// Open Connection
|
// Open Connection
|
||||||
activeNodeStatusSocket.onopen = (e) => {
|
activeNodeStatusSocket.onopen = (e) => {
|
||||||
|
|
||||||
console.log(`[SOCKET-NODE-STATUS]: Connected.`);
|
|
||||||
nodeStatusSocketcloseGracefully = false
|
nodeStatusSocketcloseGracefully = false
|
||||||
nodeStatusSocketObject = activeNodeStatusSocket
|
nodeStatusSocketObject = activeNodeStatusSocket
|
||||||
|
|
||||||
nodeStatusCount = nodeStatusCount + 1
|
nodeStatusCount = nodeStatusCount + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Message Event
|
// Message Event
|
||||||
activeNodeStatusSocket.onmessage = (e) => {
|
activeNodeStatusSocket.onmessage = (e) => {
|
||||||
|
|
||||||
doNodeStatus(JSON.parse(e.data))
|
doNodeStatus(JSON.parse(e.data))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Closed Event
|
// Closed Event
|
||||||
activeNodeStatusSocket.onclose = () => {
|
activeNodeStatusSocket.onclose = () => {
|
||||||
|
doNodeStatus({})
|
||||||
console.log(`[SOCKET-NODE-STATUS]: CLOSED`);
|
|
||||||
|
|
||||||
doNodeStatus({});
|
|
||||||
clearInterval(nodeStatusSocketTimeout)
|
clearInterval(nodeStatusSocketTimeout)
|
||||||
|
|
||||||
if (nodeStatusSocketcloseGracefully === false && nodeStatusCount <= 52) {
|
if (nodeStatusSocketcloseGracefully === false && nodeStatusCount <= 52) {
|
||||||
|
|
||||||
if (nodeStatusCount <= 52) {
|
if (nodeStatusCount <= 52) {
|
||||||
|
|
||||||
nodeStatusRetryOnClose = true
|
nodeStatusRetryOnClose = true
|
||||||
setTimeout(pingNodeStatusSocket, 10000)
|
setTimeout(pingNodeStatusSocket, 10000)
|
||||||
nodeStatusCount = nodeStatusCount + 1
|
nodeStatusCount = nodeStatusCount + 1
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// ... Stop retrying...
|
// ... Stop retrying...
|
||||||
nodeStatusRetryOnClose = false
|
nodeStatusRetryOnClose = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error Event
|
// Error Event
|
||||||
activeNodeStatusSocket.onerror = (e) => {
|
activeNodeStatusSocket.onerror = (e) => {
|
||||||
|
doNodeStatus({})
|
||||||
console.log(`[SOCKET-NODE-STATUS]: ${e.type}`);
|
|
||||||
doNodeStatus({});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const pingNodeStatusSocket = () => {
|
const pingNodeStatusSocket = () => {
|
||||||
|
|
||||||
if (nodeStateCall) {
|
if (nodeStateCall) {
|
||||||
|
|
||||||
clearTimeout(nodeStatusSocketTimeout)
|
clearTimeout(nodeStatusSocketTimeout)
|
||||||
initNodeStatusSocket()
|
initNodeStatusSocket()
|
||||||
nodeStateCall = false
|
nodeStateCall = false
|
||||||
nodeStatusSocketTimeout = setTimeout(pingNodeStatusSocket, 295000)
|
nodeStatusSocketTimeout = setTimeout(pingNodeStatusSocket, 295000)
|
||||||
} else if (nodeStatusRetryOnClose) {
|
} else if (nodeStatusRetryOnClose) {
|
||||||
|
|
||||||
nodeStatusRetryOnClose = false
|
nodeStatusRetryOnClose = false
|
||||||
clearTimeout(nodeStatusSocketTimeout)
|
clearTimeout(nodeStatusSocketTimeout)
|
||||||
initNodeStatusSocket()
|
initNodeStatusSocket()
|
||||||
nodeStatusSocketTimeout = setTimeout(pingNodeStatusSocket, 295000)
|
nodeStatusSocketTimeout = setTimeout(pingNodeStatusSocket, 295000)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
nodeStatusSocketObject.send("non-integer ping")
|
nodeStatusSocketObject.send("non-integer ping")
|
||||||
nodeStatusSocketTimeout = setTimeout(pingNodeStatusSocket, 295000)
|
nodeStatusSocketTimeout = setTimeout(pingNodeStatusSocket, 295000)
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ const sortActiveChat = (activeChatObject, localChatHeads) => {
|
|||||||
let results = newActiveChats.filter(newChat => {
|
let results = newActiveChats.filter(newChat => {
|
||||||
let value = oldActiveChats.some(oldChat => newChat.timestamp === oldChat.timestamp)
|
let value = oldActiveChats.some(oldChat => newChat.timestamp === oldChat.timestamp)
|
||||||
return !value
|
return !value
|
||||||
});
|
})
|
||||||
|
|
||||||
results.forEach(chat => {
|
results.forEach(chat => {
|
||||||
|
|
||||||
@ -103,8 +103,6 @@ const chatHeadWatcher = (activeChats) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,13 +126,13 @@ parentEpml.subscribe('logged_in', async isLoggedIn => {
|
|||||||
|
|
||||||
if (window.parent.location.protocol === "https:") {
|
if (window.parent.location.protocol === "https:") {
|
||||||
|
|
||||||
activeChatSocketLink = `wss://${nodeUrl}/websockets/chat/active/${window.parent.reduxStore.getState().app.selectedAddress.address}?encoding=BASE64`;
|
activeChatSocketLink = `wss://${nodeUrl}/websockets/chat/active/${window.parent.reduxStore.getState().app.selectedAddress.address}?encoding=BASE64`
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
activeChatSocketLink = `ws://${nodeUrl}/websockets/chat/active/${window.parent.reduxStore.getState().app.selectedAddress.address}?encoding=BASE64`;
|
activeChatSocketLink = `ws://${nodeUrl}/websockets/chat/active/${window.parent.reduxStore.getState().app.selectedAddress.address}?encoding=BASE64`
|
||||||
}
|
}
|
||||||
|
|
||||||
const activeChatSocket = new WebSocket(activeChatSocketLink);
|
const activeChatSocket = new WebSocket(activeChatSocketLink)
|
||||||
|
|
||||||
// Open Connection
|
// Open Connection
|
||||||
activeChatSocket.onopen = () => {
|
activeChatSocket.onopen = () => {
|
||||||
@ -147,16 +145,14 @@ parentEpml.subscribe('logged_in', async isLoggedIn => {
|
|||||||
// Message Event
|
// Message Event
|
||||||
activeChatSocket.onmessage = (e) => {
|
activeChatSocket.onmessage = (e) => {
|
||||||
if (e.data === 'pong') {
|
if (e.data === 'pong') {
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId)
|
||||||
activeChatSocketTimeout = setTimeout(pingActiveChatSocket, 45000)
|
activeChatSocketTimeout = setTimeout(pingActiveChatSocket, 45000)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
chatHeadWatcher(JSON.parse(e.data))
|
chatHeadWatcher(JSON.parse(e.data))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Closed Event
|
// Closed Event
|
||||||
@ -171,8 +167,6 @@ parentEpml.subscribe('logged_in', async isLoggedIn => {
|
|||||||
|
|
||||||
// Error Event
|
// Error Event
|
||||||
activeChatSocket.onerror = (e) => {
|
activeChatSocket.onerror = (e) => {
|
||||||
|
|
||||||
console.log(`[SOCKET]: ${e.type}`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,9 +191,9 @@ parentEpml.subscribe('logged_in', async isLoggedIn => {
|
|||||||
|
|
||||||
socketObject.send('ping')
|
socketObject.send('ping')
|
||||||
timeoutId = setTimeout(() => {
|
timeoutId = setTimeout(() => {
|
||||||
socketObject.close();
|
socketObject.close()
|
||||||
clearTimeout(activeChatSocketTimeout)
|
clearTimeout(activeChatSocketTimeout)
|
||||||
}, 5000);
|
}, 5000)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user