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

Add IDE messaging support to extensions API. Close #1406 #1407

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

brollb
Copy link
Collaborator

@brollb brollb commented Aug 17, 2023

This adds a pair of methods to the NetsBlox extensions for sending and receiving IDE messages. Messages are addressed using client IDs (as all IDE messages) and are passed to the same extension that originated the message to avoid message naming collisions and trivial compatibility issues.

@dragazo, @gsteinLTU - How's this look? Any questions/comments/suggestions?

@gsteinLTU
Copy link
Member

gsteinLTU commented Aug 17, 2023

I think there's a bit of confusion in what we were looking for. We were talking about messages being sent from a non-browser NetsBlox (i.e. the VM) to browser clients. The debugger extension Devin was going to make to display the VM errors would run as an extension, but it would need to receive messages from the VM running elsewhere, which can't run extensions.

This does look useful though, it might actually be helpful for the RoboScape Online extension since I could send a message to all collaborating clients prompting if they would like to join a session after someone creates one.

@gsteinLTU
Copy link
Member

Or is there a corresponding PR for cloud I didn't see? NetsBlox/cloud#99 is sort of related in concept.

@brollb
Copy link
Collaborator Author

brollb commented Aug 17, 2023

Yeah, this is only half of what is needed for the VM use-case. I still need to update the existing REST endpoint for message sending from the services server to be able to support messaging on behalf of an authenticated user (rather than just as an authorized services host - basically a read-only super user).

@dragazo
Copy link

dragazo commented Aug 17, 2023

So it looks like currently this doesn't let extensions name the message types (just uses the extension name itself)? That should be fine unless we wanted 2+ extensions that support listening to the same type of incoming messages (like different styles of debuggers that all receive the same raw input). That would be nice so the VM can always just generate messages of a single constant name and any extensions that want to receive it can just register a handler for it. I was imagining something like menu defs in extensions:

ideMessageHandlers() {
    return {
        'vm-error': function (data) { ... },
        'something else': function (data) { ... },
        'whatever': function (data) { ... },
    };
}

And if its handler is a function (rather than an arrow function), this would be the extension.

@brollb
Copy link
Collaborator Author

brollb commented Aug 18, 2023

Yeah, we can certainly do something like that. I had just kept it simple assuming that most extensions wouldn't have too many different message types. (They can always implement a convention like checking the type field and passing to different handlers.) I don't have a strong opinion and am happy to change it either way.

@brollb
Copy link
Collaborator Author

brollb commented Aug 18, 2023

@gsteinLTU - Just wrapped up the PR on the cloud side: NetsBlox/cloud#106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants