Hi there,
I am trying to write a chat app, but I am facing the issue to subscribe to the client message on the server. Any ideas how to fetch the writing events to the server db? Here's some code:await Database.getDb().then(async db => { console.log('subscribing...') db.$.subscribe((changeEvent: any) => { console.log('client is speaking: ', changeEvent); }); });
Full project: https://github.com/dancedev/dbtest
Thank you in advance.
I figured out that the data is written to the server database. Soconst repState = db.chats.syncCouchDB({
remote: 'http://localhost:5002/chatdb/chats',
options: {
live: true,
retry: true,
},
});
is working. But subscribing to the SERVER database like above delivers no notification about the UPSERT action from the client. Any ideas? -Thanks
Hi there,
I am trying to write a chat app, but I am facing the issue to subscribe to the client message on the server. Any ideas how to fetch the writing events to the server db? Here's some code:await Database.getDb().then(async db => { console.log('subscribing...') db.$.subscribe((changeEvent: any) => { console.log('client is speaking: ', changeEvent); }); });
Full project: https://github.com/dancedev/dbtest
Thank you in advance.I figured out that the data is written to the server database. So
const repState = db.chats.syncCouchDB({ remote: 'http://localhost:5002/chatdb/chats', options: { live: true, retry: true, }, });
is working. But subscribing to the SERVER database like above delivers no notification about the UPSERT action from the client. Any ideas? -Thanks
Hello again,
Rethinking my approach I figured out that I have to subscribe to the synchronisation between client and server database on the server side. Is there a way to subscribe to the sync on the server side in Node.js using couchSync on the client?
@/all
Also please do not forget to take part in the user survey 2022 pubkey/rxdb#3816
Hello all, sorry if this is not the correct place for asking this but, If I'm interested on Premium version, is there another way of asking the price? Nobody answered my request made here: https://rxdb.info/premium.html
Thank you!
Hello! I am using RxDB with replication primitives and I want to make some documents 'local only', so that they never sync. Is it enough to just filter them out in the push handler like this:
const replicationState = replicateRxCollection({
push: {
handler: (documents) => {
fetch('path/to/api', {body: documents.filter(document => !document._isLocal)})
},
},
})
Are there any pitfalls or edge cases of this approach?
Hi there! I found RxDB a couple of days ago and decided to use CouchDB to make it "easier" to sync offline devices, but I can't seem to find how to make it work with Nuxt 3/Vite. I made a question on SO and multiple attemps in the Nuxt 3 Discord server but I didn't receive a reply yet.
Uncaught SyntaxError: import not found: default
because of src/utils.js
in rxdb package.import inherits from '/_nuxt/node_modules/inherits/inherits_browser.js?v=408c3351';
hello all - I am new to rxdb and have found a number of helpful posts to get up and running to some extent. I am able to create the database, schemas, and upsert data successfully. Thank you for the help!
When I try to upsert an existing document or remove documents, I get errors like the following:
native.js:26 Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'BroadcastChannel': [object Array] could not be cloned.
at Object.postMessage (http://localhost:9300/node_modules/.q-cache/vite/electron/deps/rxdb.js?v=93b498c7:3692:21)
native.js:26 Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'BroadcastChannel': #<Object> could not be cloned.
at Object.postMessage (http://localhost:9300/node_modules/.q-cache/vite/electron/deps/rxdb.js?v=93b498c7:3692:21)
at http://localhost:9300/node_modules/.q-cache/vite/electron/deps/rxdb.js?v=93b498c7:4295:47
I am using the PounchDB IDB adapter.
Any idea what could be causing this or how I can debug it? Thank you.
:point_up: Edit: hello all - I am new to rxdb and have found a number of helpful posts to get up and running to some extent. I am able to create the database, schemas, and upsert data successfully. Thank you for the help!
When I try to upsert an existing document I get errors like the following:
native.js:26 Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'BroadcastChannel': [object Array] could not be cloned.
at Object.postMessage (http://localhost:9300/node_modules/.q-cache/vite/electron/deps/rxdb.js?v=93b498c7:3692:21)
native.js:26 Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'BroadcastChannel': #<Object> could not be cloned.
at Object.postMessage (http://localhost:9300/node_modules/.q-cache/vite/electron/deps/rxdb.js?v=93b498c7:3692:21)
at http://localhost:9300/node_modules/.q-cache/vite/electron/deps/rxdb.js?v=93b498c7:4295:47
Using upsert to add a document works fine.
I am using the PounchDB IDB adapter.
Any idea what could be causing this or how I can debug it? Thank you.
- To find out what this error means, either use the dev-mode-plugin https://rxdb.info/dev-mode.html
- or search for the error code here: https://github.com/pubkey/rxdb/search?q=DB6
Hi Everybody -
I am struggling with either a bug or a misconfiguration issue using rxdb with pouch/memory or pouch/idb. When adding and deleting a document repeatedly (but waiting in between) I get a revision error.
This shows either a lack of understanding on my part on how it is supposed to work, or some issue I am not accounting for.
I have reduced the problem to to the minimum and made a functioning git repository to demonstrate it. That is available here: https://github.com/nikonikoniko/rxdb-pouchdb-failing-revision-example
The one file is here: https://github.com/nikonikoniko/rxdb-pouchdb-failing-revision-example/blob/main/src/index.js
If anyone had a moment to look I would appreciate it!
Hello folks, maybe this is a very nonsense question. Rxdb is a very new thing for me, so, here it goes:
I have questions for the ones who are using "Replication Primitives" https://rxdb.info/replication.html
In my current test, I created a column in the database called remote_id
where I store the rxdb ID there and I don't wanna have any of it there. My database shouldn't know anything about rxdb.
One idea I have is to use UUID instead of ID, so I wouldn't have a problem with duplicated primary keys and I would have the same ID in my database and Rxdb BUT, I'm not a big fan of UUID.
My points are:
How are you all doing replication? Thank you very much!
Hello, i'm trying to replicate my local rxdb database to couchdb local but doesn't seems to work..
this is the error.
[bad_request: invalid UTF-8 JSON] {
error: 'bad_request',
reason: 'invalid UTF-8 JSON',
status: 400,
result: {
ok: false,
start_time: '2022-06-14T06:36:18.478Z',
docs_read: 0,
docs_written: 0,
doc_write_failures: 0,
errors: [],
status: 'aborting',
end_time: '2022-06-14T06:36:18.610Z',
last_seq: 0
}
}
the database is working as expected as i try to use curl there's no error. I search on google, it's because some escaping string but i don't think i can edit the internal my self. sorry for bad english.
Hello, there
When we subscribe to a collection query, why can't we see EVERY single change to it in subsequent way?
db.person.find({
selector: {},
sort: [{ name: 'asc' }]
}).$
.subscribe(console.log);
Case 1: insert one person
await db.person.insert({ name: 'Joe'});
// -> [Person]
// -> [Person]
Case 2: insert two persons
await db.person.insert({ name: 'Joe'});
await db.person.insert({ name: 'Ann'});
// -> [Person]
// -> (2) [Person, Person]
// -> (2) [Person, Person]
Case 3: insert three persons
await db.person.insert({ name: 'Joe'});
await db.person.insert({ name: 'Ann'});
await db.person.insert({ name: 'Jon'});
// -> [Person]
// -> (3) [Person, Person, Person]
// -> (3) [Person, Person, Person]
I wonder why the callback doesn't get an empty array on first time it is called, an array with a single person on second time, and so on and why it is called (number of inserted persons + 1)
times in the cases 1 and 2, but (number of inserted persons)
times in the case 3? Is it all by design or it's just a matter of chance?
Thanks in advance.
@/all
It only takes about 2 minutes. https://forms.gle/oxVToPJb6yGHkkMi7
I'm getting a SC1
code error, and I've looked it up and saw what the error was in this page: https://github.com/pubkey/rxdb/blob/master/src/plugins/dev-mode/error-messages.ts
So it means there was a field name mismatch but it wasn't telling me what fieldname it was. I've verified all by checking all my schemas and I can't see anything wrong.
subscriptions-transport-ws
for a SubscriptionClient
but that lib has been abandoned long ago. Thinking about it and looking at the rxdb
deps, there is no reason to use that library, right? I could use anything, as it's just a mechanism to get a ping from the server and inform rxdb
to do a pull. Or is that stupid?
Evening all. Just to suggest to wait if you are thinking of updating to 12.5.3
. I will submit a failing test tomorrow but whenever I try and insert/update a record with lz-string
content it totally borks with the following error with 12.5.3
(I'm using dexie storage):
rx-error.js?1dd0:111
Uncaught (in promise) RxError (SNH): RxError (SNH):
This should never happen
Given parameters: {
dataBefore:{
"id": "7988",
"lzContent": "ᯡ࠴䱠尭唡ᠰ怷ŬͰድϚ很ɐૠ䃬ǹ☸⁚<枨͢⨡泵瀬㕭ਹᨼࠠᮈႠᔊႼ<Ȍ嶄Jᒤ恅ࡦ䫇Cⳬ幀Ɲ浠敡Р⩴̾殍⽸焻㞔ഠ乶凰․瀤祋ၵ⚁䑅%匰⎇㚵䨣䦃 㶗ᫌ䀮珷ჲࢬ₆奡K䱌៨Ⴋ⟺攡彞䂝徾㏤Ѳ⩆㊳ᦣ㉼࣎ᨠᛵ冸琥凨箄RĞ䀥䧚Აɩⶌ涮䀸䀌懤ࠬ挔Ƈ㒷༈琭慙Ჿ毝晤⌺ヅᠠ⼱इᢡ㦅Ὀ琕᱿Ὢ⃰&㤽琰咶㪨ࣚĔ㍛䐮䏌僝ටߝᡔ㵁㨠沊怡ࢌ咂Შ⏝器ű旑L䨎ⅰ㭊䑂!ˌ掰߅ᨡဆ沄Ꮓ榨䷉ܐ┯敄⃢全ڗ⎄䁈兰ٷ殂༭岬␘Ɨ䙀0碁-檦嬰劑戤â狸僀ٰ涨玛怡⩅Ò㙨O䷑檀㇑初剛旡⣆僻堥亙㤻㾾⨬灊ᛐÈ⨡悺榑⾮䅖䉆捡凾䚽夊檒匉年嗊僝⣲ࡺ嶃䠡י⌠⢠็矣漠Ṡ͒欠◨怩搲澶债Წ搒ᶰూ兩⨀〤堠嵻Хᩁ㱺儠獮㞾࠴䇀塼ἤ⏫璟ี⇣繦ᒫ༯悺ࢥäҦ甠▩値灺⛀ˠ✺䞥㥰昦䊌昪䈖ြ䨠ៗ់╰礧֨ะ僡⽤ᒨ泄ℬุÊ䪠ᭉⲤ㘠᩠烠ؗ吡卾噅㪁์ᩘ䀭棍䑔ᦋ⋀ᔯℤ寈Ù䪠ᵽ⠡繳䯄䭢呁ǣ,╪䨂䥟歐᱕掂漥㠤嘧ؠ摙‥䎵⧰䫕႐䜬g㕠ྦ䯒稿ဣ媎䰕䑁䨲⁀̟⨠įT屉匢性溬Ý厐唠幠䎥ྋચ㠫斘澈ޙ溱Ἤඡ灝ɠᕢܨᆆࠚ䣤ⷡ砡ూ䐰โ恗⠡圄扤俒烉ā䫃䄬嫀ʱ⨠䨈弹ቨ羵㕰ᒣ႐性δx祠ਠ౪⡭ͨɰũᠾ瀁⻐ᇵƑ䳃㉉䲳晨懻愴↨焢♩⤮ຌ坤ላ┻㉤嶳☍Ŷጚ㢾亥ӑᕚᝀԒ㨠橅℺㖁ᅃ嬖塠㬊㫆ࣄၖ甠䱨治ķ㳳䕤橘〥⸚粄濓ᬥ哹當癐儫嚧㉀ݾ⧳㴫㝒槺㫀䄭Ϡ歵䶊䀱㜈ī庩⋌⛕॥䒴恊ᄄ֠ᆑᠢ揣জឍ˔瓑៓⧢嵂ⱀ䍝櫽捄敠㌮ফA㩇䱥樹个砵Ϻቭ礁䀠࿈ķ䩎楎ガ帄箮䩡⡪୴ເ窲ༀ湰乛⚒欇ⷴ¥᭠म㙔䏉傁ᮧ己㰠݇ࡘ〦緪u㲴ㆭ⢙债寅痧䃀㢋䀰⮂㍀ଈ擨㌢䛗⫢甲㗍᳃严哥
ٔ╄㪧䭪ᕧ⍺䵈昇化廗引℉㎡ᬍ␢ᕏ哏㻄Ų绲㎄やࠬ㗀○㖲̄¿⃠ξ・伮ఠ྾愖䀥ᯀ枀⃰皀ö吡䑹7睏纜䙥Ţ䖖尰䀶䃎Ʀ慠哠喥໕༠:⤣ȱᄰዡ㕂抣㲍䇢怱㢠ဏᐠゔ႞哸᱈ė⽠Ԟ檐紕ݘ愁ெ烀抈晰ᄠ㠳ၧ䊈Ꮷ兠唄䐮窡⠡,䀺ࢰ櫿㡎炦䙀ġ祰㕸┍&⎤䊹㴗ၒḮਠ㒼倠彳墺䌛嫑ѻ删ప倢䷍䇽㤁Ϧ༩熾ᙶ潼嗾瓍だ ",
"updatedAt": 1654590354.848436,
"_deleted": false,
"_attachments": {},
"_meta": {
"lwt": 1654612326928,
"rep-0b5b969e99d478b2c883a4dd0121d6b9": 2
},
"_rev": "2-6f96c1a1546e78b9521a01c02b27109b"
}
dataAfter:{
"id": "7988",
"lzContent": "ᯡ࠴䱠尭唡ᠰ怷ŬͰድϚ很ɐ૪‶ČXʑ⫀ᴠ晚琣℠㏊Č椘̺卥٭ܤ-娨•勀ᤖ䐷'㝙ࡊ⅐ॢ參⍫䀱䁙买䁇o⬄甶㜲吠媂ठఁ樶┢ЧዦĠ竚്ၠᯏ嚠ő⤨ⴆ⭀傠ᗦ掏戳嬛粄犠⁝‷ᵢᧇᖯ䐸䥉榒{∭䀺檡ᐐתķ熠粓ᕴဢ及ဠᥩ䒩䉆偿ᔭ倠‣ᦇ႓≝ዀ恏ݰߦ㘻䯃兆傤ਸ਼⦨ዮ•ᓦ狋┱֛䂰⁒⍐啘抑ᜡኢ䡴ᓱᏘṡ㰵ȳⒸ㋨嘉ʠ政墡[寀ୄ否䘳ࡀ敂ኩ⋤ڋ哭㼻噋㺠କ倩犗Ӵ檬•⩽кᅂ懅眬䐠ĪヨႽ≦ㇿ⡰Ȁ⠳㖂⢣⁰㑲ʽ䬅祯康ሠᨚ䀴㽠佛㥴Ԫㆁ☴丱Ё慖ቊ挙撠՚䂰J䴢䱏␂簠⺿䥭嫒䑀⻓ޘ㶲ڢ憐簱٤╨ᘵᄨ☩䱢熘Ş⩂䇤䥊ሣ㫹ᇇ哊峈潰啎㪢┡Ꮖ嚬ጦ径㦼圧䘆䬄ア尫栬擊⇉攒愮婼Ǟ㺠㻿墝旋僁㮧㎐梆䂔ਡ㒒ɠ̫̀㤴Ԣ䠢┝䛨ƭ张晏᷌㑽嗢ಹ截牍焦㊁ࢠ̕泚䡅㉀ቁ呃吴ᄀ到檲侢棗倧冻൳浸梂㽀䌒眰ࠠĄӑ璙ᜫθडࠡఠ咒ɠ˫㥞↛⢠ࡀ⌠㵉値㾻ដ池⡲ؘ絵'帻g潰ሢq⋀ٷ櫞䮱ጰؤ┪✵㌐ᬠǚ偵䢣Ⴙᠡ䌄ӛࠡ䪷ᢥ⤴䲇㡀㓔+猢⤑ॱ洡⢋ị⤎൨⠢杜䲅揁ʍ䧡模ఠᔪ䀼揼吡⇎⌡┒㚷刨儁Ⳁ犲䤋㖥ᷕĸb湎‥ࠠ煋ᄨ⤠ཎ堨怤岬n℘娩⡈⛤紻ໃ⒟Ḓ@̠㈭ⴿԭ懄㕡冪á堾߉ʚ㏀ᚴ揀䱙ˁ㧍၌戨±ぉ㐡ᙆ䀳䆈ǩ᪠ଡᓇ⭻䚈栶ச̖࣠獒撕汨卑ם斤྄⁛කঁ㟀ˊ⨠泅ᗰ䯨⤫㴠倦䶚⇰⫈憹ᠡ崴Ổࡐⱚ㕧◀̆⨠疕‧祫㗸漌თ倡䓈䢬ႷⲺᮌ吲嬤建ᦹᠣᄅ6䴰⅊㋾䀨盈Ȑ樜模ぢ⼺扔方ç亽Ȭ眔畠A炶ⱁʹᓬ䰠緱䀷媁❚Ⲧ侨⣾ᯀҍჃ㿅恭Dz⳿శ攬ቍ┤惨䶤矨Ş䆠ݜ旌㽻栠䤖᷁㟔䵍滁企ᵆ灂ㆀ؛䩇栿䡰俆➝䡈ᅶ䂘೩䰸筨甫Ꮰ:⪡汁༂ဦ捄ྙ㊙伪ʼ࣠ဏᐠᓎ̊独Ȇ☠篏
绶但瞴祳瓖㍟⒁壣᭸䳝綵昮埅冬᜔ آᦣ嶗ໃᄫ疟厢൮構ᱠ砏仦呗䪡䘫䮚T买⥧䓌掺䁷䬲,հŭ圃攨匲̦墋ⶨㆦᷔ䵫㈐† ",
"_meta": {
"lwt": 1
},
"_deleted": false,
"_attachments": {},
"_rev": "1-1b0889e30899ca856e0d6f4b1c8ec493"
}}
at newRxError (rx-error.js?1dd0:111:1)
at eval (rx-storage-helper.js?3390:447:29)
at Array.forEach (<anonymous>)
at transformDocumentDataFromRxDBToRxStorage (rx-storage-helper.js?3390:445:1)
at eval (rx-storage-helper.js?3390:516:1)
at Array.map (<anonymous>)
at Object.bulkWrite (rx-storage-helper.js?3390:515:1)
at eval (rx-document.js?8769:626:1)
This works flawlessly in 12.4.3
.