Subscriptions working

This commit is contained in:
2021-06-05 14:17:58 +02:00
parent 43f26e8ea9
commit 5b2deaa346
2 changed files with 56 additions and 44 deletions

View File

@ -100,7 +100,8 @@ export class App {
this.defaultLocation = "/";
this.setHash("/");
} else {
throw Error(response.message);
console.error(response.error);
throw Error(response.error.message || response.error.code);
}
}
@ -237,14 +238,14 @@ export class App {
this.addMessage(input.value);
const val = input.value;
input.value = "";
await this.session.sendEvent("60nc0XXDIYUh6QzX4p0rMpCdzDmxghZLZk8dLuQh628", {
await this.session.newEvent("60nc0XXDIYUh6QzX4p0rMpCdzDmxghZLZk8dLuQh628", {
message: val,
});
}
});
this.session.subscribe(response => {
this.addMessage(response.data.event.data.message);
this.addMessage(response.data.data.message);
});
}
}