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

build HTTP server device #168

Closed
warner opened this issue May 16, 2019 · 2 comments
Closed

build HTTP server device #168

warner opened this issue May 16, 2019 · 2 comments
Labels
SwingSet package: SwingSet

Comments

@warner
Copy link
Member

warner commented May 16, 2019

For interaction with UIs and CLI-based tools, we need a way to send messages into a machine. Not everything is a swingset machine, so we should enable some sort of lower-tech protocol.

I'm thinking the device node should use Node's built-in HTTP server, and the root object should provide a registerHandler function. Each time an HTTP request arrives, the handler will receive a message that includes the full contents of the request as arguments, plus a "response index" or handle of some sort. Calling a second function on the root object with the response index causes the HTTP request to be answered. We can then wrap this in a Vat which does some minimal dispatch/routing, and presents a promise-based interface (so the real target of the message can trigger a response by just fulfilling their response promise to the HTTP response data).

It might also be interesting to add an HTTP client device, but that's lower priority for now.

@warner
Copy link
Member Author

warner commented Jun 3, 2019

0cfc866 adds the "command" device, which is the part that belongs in SwingSet. It gives a way to send commands into a swingset machine, returning a promise for the result. Internally, each command is given a number, and the recipient of the command is responsible for calling D(devices.command).sendResponse(number, value) when that promise ought to be resolved. There's also a broadcast channel which we need for the REPL frontend.

So I think I can close this now. For an example of how the command device should be used to provide an HTTP-based invocation tool, look in cosmic-swingset at lib/ag-solo/web.js and start.js.

@warner warner closed this as completed Jun 3, 2019
@warner
Copy link
Member Author

warner commented Dec 4, 2019

in the old repo. this was SwingSet issue 46

@warner warner transferred this issue from Agoric/SwingSet Dec 4, 2019
@warner warner added the SwingSet package: SwingSet label Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SwingSet package: SwingSet
Projects
None yet
Development

No branches or pull requests

1 participant