How can I handle table deltas when a Table row is "removed" from the table?

You can handle removal of a row in the `table_delta` message by first inspecting if it’s an `rem` (removal) operation by checking the value `message.data.dbop.op` (`string`). When it’s a removal operation, the field `message.data.dbop.old` will be populated with the removed row (as a JSON if you specified `json: true` in your stream request parameters, in HEX data otherwise)

Code (using `eosws-js`):

if (message.type === InboundMessageType.TABLE_DELTA) {

const tableDelta = message.data as TableDeltaData

console.log(`Table delta operation ${tableDelta.dbop.op}.`)

if (tableDelta.dbop.op === "rem") {

console.log(" Handling removal of row, previous row data.", JSON.stringify(tableDelta.dbop.old))

}

}