-
Notifications
You must be signed in to change notification settings - Fork 275
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
Fake socket that doesn't need serializing/deserializing #195
base: main
Are you sure you want to change the base?
Conversation
/* | ||
* Send an IMessage through the socket | ||
*/ | ||
sendMessage (data: KernelMessage.IMessage) { |
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.
This is more or less a copy of WebSocket.send
only that it doesn't force the data
to be a string
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.
Instead it passes the KernelMessage.IMessage
without touching it
It's in a non-working state. I am opening this PR so that we can discuss it. |
Thanks Martin for exploring this 👍 There is definitely room for improvement at the message passing level. For now |
As a side note, we'll also probably want to have both in-browser and "normal" kernels supported at the same time. But that's something for another issue. |
This is a good step. There is a certain value in adhering as closely as possible to the WebSocket API, as some extensions will expect some of the plumbing to work exactly that way (even if they shouldn't). On that end, we should probably consider adding kernelspy to the demo site, and ensuring we generate content there, as losing the browser websocket playback, which just got good enough to use, is pretty crippling when you're building something and it goes wrong. I'd love to eventually see a more broad embracing of native async generators on both the python and browser sides... i did a tiny bit of that over on #141. Definitely sounds like an upstream 2.0 (jp server) / 4.0 (lab) thing. |
Sounds good 👍 Opened https://github.com/jtpio/jupyterlite/issues/197 to track this. |
After further investigation, I think it doesn't work because we also need to mock the server-mock and proxy-factory, which both use That seems like a lot to mock in the mock socket... |
Currently, the mock-socket's
WebSocket
needs a string to be passed through the "fake wire". This means we need to serialize messages, pass them through the wire, then deserialize.Instead, it would be faster and more robust to be able to pass the original message through, without any serialization involved.