Add ping to the client, reconnect on dead connections

This commit is contained in:
maciejhirsz
2018-07-25 17:49:53 +02:00
parent c12374209d
commit a909400678
4 changed files with 88 additions and 14 deletions
+8 -1
View File
@@ -29,6 +29,7 @@ export const Actions = {
RemovedChain : 0x09 as 0x09,
SubscribedTo : 0x0A as 0x0A,
UnsubscribedFrom : 0x0B as 0x0B,
Pong : 0x0C as 0x0C,
};
export type Action = typeof Actions[keyof typeof Actions];
@@ -98,6 +99,11 @@ export namespace Variants {
action: typeof Actions.UnsubscribedFrom;
payload: ChainLabel;
}
export interface PongMessage extends MessageBase {
action: typeof Actions.Pong;
payload: string; // just echo whatever `ping` sent
}
}
export type Message =
@@ -112,7 +118,8 @@ export type Message =
| Variants.AddedChainMessage
| Variants.RemovedChainMessage
| Variants.SubscribedToMessage
| Variants.UnsubscribedFromMessage;
| Variants.UnsubscribedFromMessage
| Variants.PongMessage;
/**
* Opaque data type to be sent to the feed. Passing through
+2 -1
View File
@@ -6,4 +6,5 @@ import * as FeedMessage from './feed';
export { Types, FeedMessage };
export const VERSION: Types.FeedVersion = 5 as Types.FeedVersion;
// Increment this if breaking changes were made to types in `feed.ts`
export const VERSION: Types.FeedVersion = 6 as Types.FeedVersion;