@knowlearning/agents 0.3.11 → 0.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/agents/generic.js CHANGED
@@ -89,7 +89,7 @@ export default function Agent({ host, token, WebSocket, protocol='ws', uuid, fet
89
89
 
90
90
  ws.onmessage = async ({ data }) => {
91
91
  try {
92
- log('handling message')
92
+ log('handling message', disconnected, authed)
93
93
  const message = JSON.parse(data)
94
94
  log('message', message)
95
95
 
@@ -157,6 +157,7 @@ export default function Agent({ host, token, WebSocket, protocol='ws', uuid, fet
157
157
  ws.onclose = async () => {
158
158
  if (authed) log(`CLOSED DOMAIN ${domain} USER ${user} SESSION ${session} CONNECTION TO SERVER ${server}`)
159
159
  authed = false
160
+ ws.onmessage = () => {} // needs to be a no-op since a closing ws can still get messages
160
161
  if (!disconnected) {
161
162
  await new Promise(r => setTimeout(r, Math.min(1000, failedConnections * 100)))
162
163
  failedConnections += 1
@@ -320,7 +321,6 @@ export default function Agent({ host, token, WebSocket, protocol='ws', uuid, fet
320
321
 
321
322
  function disconnect() {
322
323
  log('DISCONNECTED AGENT!!!!!!!!!!!!!!!')
323
- authed = false
324
324
  disconnected = true
325
325
  ws.close()
326
326
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowlearning/agents",
3
- "version": "0.3.11",
3
+ "version": "0.3.13",
4
4
  "description": "API for embedding applications in KnowLearning systems.",
5
5
  "main": "node.js",
6
6
  "browser": "browser.js",