-
Notifications
You must be signed in to change notification settings - Fork 5
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
connections
state needs improvement
#38
Comments
For 1, the different isn't client vs. server, but rather the client vs. master bus on the server. For instance: master = require('statebus').serve({
client: (client) => {
...
client.fetch('connections') // Here you get {key: 'connections', all: [...]}
} The client vs. master bus distinction has always bugged me, and I'm sorry that it's biting you here too. I'd like a better solution to giving each client their own state space, without confusion like this. I've also considered making a sub-space within a single bus, like perhaps For 2, maybe this is the same problem as 1? I just tested the |
Yeah that's very confusing. Also I don't necessarily want to start a server if I just want to write unit tests. I'll open a PR to tawk to show you what I'm working on. |
Also I think |
That would make unit tests in my PR a lot shorter / more readable. |
I agree about the The reason However, I have improvements in mind for both the JSON encoding and the network protocol, which will break compatibility, and I want to implement them all at once in version 7. The new JSON encoding will simplify the implementation of the |
I've listed the upcoming breaking changes here: https://wiki.invisible.college/statebus/dev You'll see that refactoring |
The
connections
state is nice to have, but it's a little confusing to use.It looks different on the client and server. On the client,
fetch('/connections')
->{key: '/connections', all: [{...}, {...}]}
, and on the server,fetch('connections')
->{key: 'connections', connId1: {...}, connId2: {...}}
It doesn't work with the
state
interface -- must call fetch/saveThe text was updated successfully, but these errors were encountered: