-
Notifications
You must be signed in to change notification settings - Fork 257
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
Implement client-server interaction via @server and @browser-session #620
Conversation
Example program I used to test:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good. It raises a few questions about how this should interact with other aspects of the language, but so long as we mark this guy as being prototype only I don't see that as being blocking.
@@ -1,4 +1,4 @@ | |||
export enum Owner {client, server}; | |||
export enum Owner {client, server, both}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are there any other options here? If not both is probably fine, but if so we might want to be more explicit.
@@ -118,6 +118,19 @@ export abstract class RuntimeClient { | |||
actions.push(new ActionImplementations["+="]("event", e, a, v, "event", scopes)); | |||
} | |||
this.evaluation.executeActions(actions); | |||
} else if(data.type === "result" && (data.database === "server" || data.database === "browser-session")) { | |||
// @TODO: should we allow databases other than server at some point? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we need to figure out how the extensibility story and policy story interact to give us this if we think it's important. This isn't blocking but it merits a research task.
// we need to add a browser-session bag and also make our local browser bag | ||
// be a normal database that way we don't send UI that is already being handled | ||
// by the client | ||
if(config.runtimeOwner === Owner.both) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could potentially make client-server equipped code run on either/or as well if we always add this and just let it play telephone with itself. I don't know that doing so is particularly useful, but it may be good for testing at least.
I don't think this is the "right" solution moving forward, so closing this out for now. |
This adds a new kind of database that attempts to send its adds over the socket to either the client or the server depending on where it's running. It also adds the
--clientAndServer
flag, which allows you to run your program both on the client and server.