incognitolm commited on
Commit
54277fc
·
1 Parent(s): d2850b8

Update chatStream.js

Browse files
Files changed (1) hide show
  1. server/chatStream.js +2 -2
server/chatStream.js CHANGED
@@ -61,7 +61,7 @@ async function websocketChatStream(body, headers, onToken) {
61
  : LIGHTNING_BASE.replace("http", "ws")
62
  ) + "/ws/chat";
63
  await new Promise(resolve => {
64
- ws.onopen = resolve;
65
  });
66
 
67
  ws.send(JSON.stringify({
@@ -105,7 +105,7 @@ async function websocketChatStream(body, headers, onToken) {
105
  }
106
  });
107
 
108
- ws.onerror = reject;
109
  });
110
  }
111
 
 
61
  : LIGHTNING_BASE.replace("http", "ws")
62
  ) + "/ws/chat";
63
  await new Promise(resolve => {
64
+ ws.on("open", resolve);
65
  });
66
 
67
  ws.send(JSON.stringify({
 
105
  }
106
  });
107
 
108
+ ws.on("error", reject);
109
  });
110
  }
111