I create AppSync API from Amplify Cli for my angular project.
The website can subscribe to OnChangeListner where DynamoDB is updated by mutation. It works.
async ngOnInit() {
this.api.OnUpdateTableListener.subscribe({
next: resp => {
console.log("update !!!");
console.log("update: " + JSON.stringify(resp));
let update = resp.value.data.onUpdateTable;
this.items = this.items.map(function(a) {
return a.id === update.id ? update : a;
});
}
});
}
async update(selectedItem) {
const update = {
id: selectedItem.id,
status: !selectedItem.status
};
await this.api.UpdateTable(update);
}
However, I noticed that if I updated DynamoDB manually, the subscription doesn't work at all.
Any suggestion on how to update DynamoDB (not by mutation) and AppSync subscriptions still work.
