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

client implementations #216

Open
gedw99 opened this issue May 24, 2024 · 4 comments
Open

client implementations #216

gedw99 opened this issue May 24, 2024 · 4 comments

Comments

@gedw99
Copy link

gedw99 commented May 24, 2024

the docs reference basic rust one here: https://superfly.github.io/corrosion/api/subscriptions.html#client-implementation-guide

But I expect that Js and Golang and other devs would like some simple examples for using the API from their languages. Especially the Subscriptions.

https://superfly.github.io/corrosion/api/subscriptions.html#reconnections-and-retries begs the question of letting clients have a list of other Corrosion servers so that they can load balance in case the current one disappears. #181 is the rust one.

@gedw99
Copy link
Author

gedw99 commented May 25, 2024

I am looking for a golang client that can easily parse the subscriptions.

I wil then use nats Jetstream to de-duplicate the subscription feed so only one of the golang servers processes the changes . It’s quite important that only 1 golang server processes the changes of course.

Here is the NATS Jetstream reference

https://nats.io/blog/new-per-subject-discard-policy/

each subject is a sql subscription … or something like that.

Testing this is not easy . 5 data servers on fly with nats , corrosion on each server and a client in each geographical region . Try all run their tests and then the final aggregated result needs to be checked . Always fun . Fly does make this much easier at least than other offerings.

@gedw99
Copy link
Author

gedw99 commented May 26, 2024

It looks like shadow dom and html out of order streaming is the way to go for making a simple example.

this is a golang example.

https://github.com/ryoid/go-streaming-html-ooo

This is the same using node.

https://kodus.pl/#close

—-

What I like is that is that it is alarmingly simple , and takes advantage if corrosion subscriptions.

For the browser it’s using the shadow dom and slots . https://developer.chrome.com/docs/css-ui/declarative-shadow-dom Works on all browsers now.

@jeromegn
Copy link
Member

For reference, we are using this code for subscriptions from Go: https://gist.github.com/jeromegn/22d88b1b0399b40d4a714b4367dec430

@gedw99
Copy link
Author

gedw99 commented May 28, 2024

thanks @jeromegn

I was going to use https://github.com/olivere/ndjson as the Corrosion docs said its that format structure.

I have had little time to dig into this, so some of my questions are probably naive, but :

Yours is a generic parser of ndjson ?
Yours does not require types be setup ?

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