Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i use it with Google diff match patch library #532

Open
ankush-dcoder opened this issue Dec 21, 2021 · 9 comments
Open

How can i use it with Google diff match patch library #532

ankush-dcoder opened this issue Dec 21, 2021 · 9 comments

Comments

@ankush-dcoder
Copy link

Our client app is Android and written in Java, we use Google's diff-match-patch library extensively. How do we use sharedb with this as ot type?

@curran
Copy link
Contributor

curran commented Dec 22, 2021

It's not an OT type, but this diffing library can translate output from Google's diff-match-patch into JSON0 or JSON1 ops: https://github.com/kbadk/json0-ot-diff

@ankush-dcoder
Copy link
Author

Thanks for the answer @curran. One more thing, the use case we have is based on real time editing of json document, and I see json0 ot type as a great fit for this use case, unfortunately i couldn't find a client library implementation for json0 diffs in java for Android app client. Is there a supported library written in java for json0?

@curran
Copy link
Contributor

curran commented Dec 22, 2021

I don't believe there are any Java implementations for json0.

@ankush-dcoder
Copy link
Author

ankush-dcoder commented Dec 22, 2021

That seems like a deadend. I found this json diff library for java zjsonpatch . Can you guide me if i want to use it, do i need to implement this as a new ot-type library by providing definition for all the required functions?

@curran
Copy link
Contributor

curran commented Dec 22, 2021

I have no experience with ShareDB + Java. I don't think anyone does. It would probably be quite difficult to build a ShareDB client in Java. Perhaps you can use JavaScript within your Android app?

@ankush-dcoder
Copy link
Author

ankush-dcoder commented Dec 22, 2021

Android doesn't run js natively, it's really difficult to run js as logic in as a part of native app.

On the other note I think i'll be able rewrite some part of google-diff algo and produce ot-text like diffs to send, but i was worried about using text ot for a json document, one character wrong patch can make the whole document unusable with json parsing errors. In your experience have you seen ot text working well for json documents too? (As in the end each json can be presented as text.)

@curran
Copy link
Contributor

curran commented Dec 22, 2021

You're right that text OT is not suitable for JSON, as like you say, one wrong patch can make the whole thing unstable.

@ankush-dcoder
Copy link
Author

Thanks for all the help, saved me some experimentation time.

@curran
Copy link
Contributor

curran commented Mar 2, 2023

Suggest to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants