Closed elsacutealways closed 1 year ago
I apologize if this isnt proper etiquite as I dont use gitbhub often but I am in dire need of help in regards to subscribe() and was wondering if you are able to share how you got it to work temporarily? I for the life of me can not figure out how to handle to callback argument requirement and there is very little discussion online about pocketbase in general nevermind this package.
A very naive example how subscribing is done is the following Note that this obviously assumes you have a collection with id = coll_id that has a record field called "title".
c = client.collection(coll_id)
def callback(e: MessageData): ##this will be called completely out-of-order whenever an event happens in pocketbase
print(e.record.title)
c.subscribe(callback)
sleep(0.1)
for _ in range(10)
c.create({"title": "Hello World"}) ## create a record (even an create in a completely different client will trigger above event)
sleep(1)
I hope this helps. Note that unsusbscribe() currently has a bug #45 but the subscribe() method should work fine like above.
Hi, @elsacutealways. can you provide more details, I can't figure out what do you mean by "run subscribe forever", and if you happen to use or see the javascript/dart implementation of what you need, it would be of big help to send us in here.
Closed due to inactivity
How to run subscribe() forever?