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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to an sdk package #95

Open
lil5 opened this issue Apr 25, 2024 · 7 comments
Open

Move to an sdk package #95

lil5 opened this issue Apr 25, 2024 · 7 comments

Comments

@lil5
Copy link
Contributor

lil5 commented Apr 25, 2024

Instead of reimplementing common chat functionality on each client, create an sdk that is plugged into mobile and web apps.

This could handle;

  • Improve bot support 馃
  • Move to redaxios

The sdk should not contain any react. Instead async and callbacks should be used

const sdk = new DatabagSdk()

sdk.onLogin(()=>{})

const room = sdk.selectRoom()
const g = () => appview(room.renderConversation())
room.onUpdate(g)

This is just an example of functionality not structure.

With an sdk the react could move to a more passive role of displaying data when the sdk says so.

@balzack
Copy link
Owner

balzack commented Apr 25, 2024

Yes, I agree. Along those lines, I can see it allowing for other clients to participate in the network while maintaining interoperability. Just because clients speak the same protocol or api, doesn't mean they work well together.

It would be nice if there was just one SDK, but mobile generally requires storage for offline viewing. Supporting both modes within a single SDK may be messy.

There are a few new features, maybe bundled as separate apps, that I would like to include in an SDK. Perhaps it's over designing, but it goes to my hopes that the databag backend can be more general than a message service.

  • contact list with selective access to attributes (ie. phone number for friends, email for work colleagues)
  • photo albums with selective access (ie. family can see family photos, work colleagues can see conference photos)

Thank you for the suggestion!

@lil5
Copy link
Contributor Author

lil5 commented Apr 26, 2024

but mobile generally requires storage for offline viewing. Supporting both modes within a single SDK may be messy.

That would require an optional addOfflineSqliteStorage(db)

Interoperability with other sqlite libraries isn't necessary as a non react native library exists too. https://github.com/asnando/sqlite-storage

@balzack
Copy link
Owner

balzack commented Apr 26, 2024

Thank you for this reference. I have a rough idea what the API should look like now, but am not yet sure how much the refactor effort will be.

I will likely start the SDK work in a month or two, after I complete several other commitments. Would you be willing to review the SDK API after I finish a draft?

@lil5
Copy link
Contributor Author

lil5 commented Apr 27, 2024

Definitely 馃憤

I'd suggest cut-pasting from frontend to sdk then altering from there, that way you never have a commit where everything is broken.

@balzack
Copy link
Owner

balzack commented May 2, 2024

I need to move the typescript changes into a branch until I can fix it:
https://github.com/balzack/databag/tree/typescript

Deploying the latest gives me: 'Uncaught ReferenceError: require is not defined'

I thought I had tested it, but I must have been using a stale build.

@lil5
Copy link
Contributor Author

lil5 commented May 3, 2024

I'll see if I can work on the docker development env, you seem to be using production builds instead of the local code.

I haven't yet got it working properly (on a Mac machine)

@balzack
Copy link
Owner

balzack commented May 3, 2024

It might not be worth this effort. When I start the SDK refactor work, I will make sure to use typescript.

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