mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 03:25:15 +00:00
Add handling for websocket errors
This commit is contained in:
parent
014663bb66
commit
0bb0c6a69b
|
@ -919,6 +919,9 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
_handleWebsocketMessage(ws, event: MessageEvent<any>) {
|
_handleWebsocketMessage(ws, event: MessageEvent<any>) {
|
||||||
const msg: FTWsMessage = JSON.parse(event.data);
|
const msg: FTWsMessage = JSON.parse(event.data);
|
||||||
switch (msg.type) {
|
switch (msg.type) {
|
||||||
|
case FtWsMessageTypes.exception:
|
||||||
|
showAlert(`WSException: ${msg.data}`, 'danger');
|
||||||
|
break;
|
||||||
case FtWsMessageTypes.whitelist:
|
case FtWsMessageTypes.whitelist:
|
||||||
this.whitelist = msg.data;
|
this.whitelist = msg.data;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
export enum FtWsMessageTypes {
|
export enum FtWsMessageTypes {
|
||||||
|
exception = 'exception',
|
||||||
|
|
||||||
whitelist = 'whitelist',
|
whitelist = 'whitelist',
|
||||||
entryFill = 'entry_fill',
|
entryFill = 'entry_fill',
|
||||||
entryCancel = 'entry_cancel',
|
entryCancel = 'entry_cancel',
|
||||||
|
@ -56,7 +58,13 @@ export interface FtNewCandleMessage extends FtBaseWsMessage {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface FtErrorMessage extends FtBaseWsMessage {
|
||||||
|
type: FtWsMessageTypes.exception;
|
||||||
|
data: string;
|
||||||
|
}
|
||||||
|
|
||||||
export type FTWsMessage =
|
export type FTWsMessage =
|
||||||
|
| FtErrorMessage
|
||||||
| FtWhitelistMessage
|
| FtWhitelistMessage
|
||||||
| FtEntryFillMessage
|
| FtEntryFillMessage
|
||||||
| FTEntryCancelMessage
|
| FTEntryCancelMessage
|
||||||
|
|
Loading…
Reference in New Issue
Block a user