Show more info on web socket close
This commit is contained in:
parent
b946ac2bc4
commit
42f1c34863
|
|
@ -1,6 +1,7 @@
|
||||||
import {SnackReporter} from '../snack/SnackManager';
|
import {SnackReporter} from '../snack/SnackManager';
|
||||||
import {CurrentUser} from '../CurrentUser';
|
import {CurrentUser} from '../CurrentUser';
|
||||||
import * as config from '../config';
|
import * as config from '../config';
|
||||||
|
import {AxiosError} from 'axios';
|
||||||
|
|
||||||
export class WebSocketStore {
|
export class WebSocketStore {
|
||||||
private wsActive = false;
|
private wsActive = false;
|
||||||
|
|
@ -32,10 +33,17 @@ export class WebSocketStore {
|
||||||
|
|
||||||
ws.onclose = () => {
|
ws.onclose = () => {
|
||||||
this.wsActive = false;
|
this.wsActive = false;
|
||||||
this.currentUser.tryAuthenticate().then(() => {
|
this.currentUser
|
||||||
this.snack('WebSocket connection closed, trying again in 30 seconds.');
|
.tryAuthenticate()
|
||||||
setTimeout(this.listen, 30000);
|
.then(() => {
|
||||||
});
|
this.snack('WebSocket connection closed, trying again in 30 seconds.');
|
||||||
|
setTimeout(this.listen, 30000);
|
||||||
|
})
|
||||||
|
.catch((error: AxiosError) => {
|
||||||
|
if (error && error.response && error.response.status === 401) {
|
||||||
|
this.snack('Could not authenticate with client token, logging out.');
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.ws = ws;
|
this.ws = ws;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue