update: websocket
- enable save button in overview Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
parent
a29ff0be1a
commit
a0637c7d72
3 changed files with 37 additions and 18 deletions
|
|
@ -17,6 +17,10 @@ export function connectToWebsocket() {
|
|||
if (browser) {
|
||||
// console.log('connecting to ', env.PUBLIC_WSS);
|
||||
try {
|
||||
if (socket != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
socket = new WebSocket(`${env.PUBLIC_WSS}`);
|
||||
|
||||
socket.addEventListener('open', () => {
|
||||
|
|
@ -62,6 +66,16 @@ export function connectToWebsocket() {
|
|||
});
|
||||
}
|
||||
}, 10000);
|
||||
|
||||
if (auth.currentUser && socket == null) {
|
||||
console.log('try reconnect websocket ...');
|
||||
// retry again
|
||||
setTimeout(() => {
|
||||
if (socket == null) {
|
||||
connectToWebsocket();
|
||||
}
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
|
||||
socket.addEventListener('message', (event) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue