Websocket live query subscription returns only update events

I have created a manual websocket subscription using Python to the parse-server and receiving directly the events from synching. (Kind of hacking the js sdk with a raw python implementation)

It seems to work perfectly, but I always get updated events instead of create when there are new events synched from the contract ABI synchronizer.

Does it have to do with the way the query is formulated? Is it “updating” the index entries when I specify limit(10) for example?

I assumed it would use create for new database entries but now I’m uncertain and looking for confirmation whether it is maybe updating query positions/ elements locally instead of creating/deleting them.

Seems like a very exotic sort of application, so not sure whether this is the right spot to ask but maybe someone has some pointers as to how it works internally.

you will only see update events for the event syncing, the reason is because internally upsert is used to set that info in the database. You can still differentiate between an update an a create based on the extra info associated with that event

1 Like

I noticed that the original object has all fields unset if it is new, so quite easy to differentiate then with a field lookup attempt.

Thanks for confirming. I assumed it is something that went wrong when doing this hacky raw websocket implementation with Python Parse objects. But seems its working then. :grinning_face_with_smiling_eyes:

Cool to have real time Python database connection to the blockchain. Moralis has become so powerful :muscle:

1 Like