Binary protocol channeling over HTTP #319
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Requires the server to run with edgedb/edgedb#3682.
@jaclarke James, I hope this would unblock you to implement querying from the admin panel.
Some notes:
I've only tested this running from the nodejs environment (not browser). The key limitation here is that node (pre 17.5) doesn't have native
fetch()
, so I'm usingnode-fetch
to emulate it for testing purposes. When you run this in the browser, you might need to updateFetchSocket.write()
to properly cast emulatedBuffer
to something that browser'sfetch()
can understand (most likelyArrayBuffer
).Every HTTP request essentially creates a new (temporary) binary connection on the server. Which means that the typical
[parse] [execute]
message sequence doesn't work![parse]
it creates an anonymous statement.[execute]
message doesn't see that anonymous statement, because the connection is already different.[parse] [optimisticExecute]
sequence, essentially not relying on anonymous statements at all..query()
method to do just that and it works. However, iirc the studio uses therawExecute
method that would have to be updated to also use optimistic execute.Aside from the above it should work in the browser. I'll be completing some ToDos over the next couple of days, but you should be able to start playing with this.
ToDo
FetchSocket
createClient
to automatically detect the browser environment and try to usefetch()
? (this decision can wait at least until we think about enabling this feature beyond admin panel)@jaclarke to test things from nodejs:
(don't forget to run
yarn
to installnode-fetch@2
)James, lastly, please commit and push directly to this branch when you make this work in the browser.