Idea: Protocol plugins, client/server capability handshake
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6.5k
- Forks
- 456
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 5
Description
These are some of my thoughts around enabling more extensibility of ShareDB and more rapid development of new ideas. I'm hoping to find some time in the next month or two to write a more fleshed out spec, but in the meantime, comments and more ideas are welcome!
ShareDB message protocol plugins
Over the past couple years, there have been new features that require extending the ShareDB message protocol with different request.a "actions":
fetchSnapshotByTimestamp- Presence, still in progress
These are handled in large switch statements:
- On the server in Agent: https://github.com/share/sharedb/blob/v1.1.0/lib/agent.js#L334
- On the client in Connection: https://github.com/share/sharedb/blob/v1.1.0/lib/client/connection.js#L183
I've been thinking it would be good to implement a framework for message protocol plugins, and refactor more optional features like queries, fetchSnapshotByTimestamp, and presence into plugins. This has some nice advantages:
- ShareDB users could choose exactly what features they want, keeping code and bundle sizes smaller.
- We can develop new protocol-level features more rapidly as independent plugins, compared to developing them in ShareDB core. They can also be independently semver'd.
- ShareDB users could author their own protocol plugins without needing to touch ShareDB core.
One of the requirements to accomplishing this is that clients and servers need to be able to do some sort of capability handshake, so they can agree on what protocol plugins to use for the session and at what versions.
Client/server capability handshake
I haven't put much thought into this yet. It could work like a simpler version of a TLS handshake. It would need to include at least:
- Capability names
- Capability versions
Potential use cases for a capability handshake:
- ShareDB message protocol plugins
- Making it easier to do major semver updates to ShareDB core
- Negotiating a default OT type or supported OT types in general: https://github.com/share/sharedb/issues/284
- Custom application-specific capabilities defined by ShareDB users
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the switch statements in lib/agent.js and lib/client/connection.js, along with the related discussion in issue 284. The issue currently proposes protocol plugins and a capability handshake but does not define an implementation-ready scope or completion criteria; a fleshed-out specification would be needed before coding can begin.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend-api-design, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100