chat-js: resubscribe on error, not just on quit
@@ -21,7 +21,10 @@ export class Subscription {
subscribe(path, app) {
api.bind(path, 'PUT', api.authTokens.ship, app,
this.handleEvent.bind(this),
- this.handleError.bind(this),
+ (err) => {
+ console.log(err);
+ this.subscribe(path, app);
+ },
() => {
this.subscribe(path, app);
});
@@ -48,10 +51,6 @@ export class Subscription {
store.handleEvent(diff);
}
- handleError(err) {
- console.error(err);
- }
-
fetchMessages(start, end, path) {
console.log(start, end, path);
fetch(`/~chat/paginate/${start}/${end}${path}`)
