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

Initial Implementation of Plugins for Bison Relay #597

Closed
wants to merge 19 commits into from

Conversation

vctt94
Copy link
Contributor

@vctt94 vctt94 commented Jul 15, 2024

Status: Ready for Review

Summary:

This PR introduces the initial implementation of plugins for Bison Relay, providing a foundational setup for plugin integration and two example plugins to demonstrate functionality.

Key Features:

  • Plugin Initialization: Enables Bison Relay clients (brclient) to initialize a plugin server by enabling JSON-RPC listeners. This allows brclient to act as a bridge, facilitating communication between the plugin server and other clients.

  • Plugin Communication: Supports seamless connections between brclient instances and plugin servers, enabling new interaction possibilities and extending the functionality of the Bison Relay network.

Examples Included:

  • Version Plugin: Demonstrates how to retrieve and display version information of a plugin connected to a brclient.
    View Version Plugin Example

  • Chat Plugin: Shows how to implement chat functionality via a plugin server, illustrating the potential for plugins to expand brclient capabilities.
    View Chat Plugin Example

Usage and Setup:

  • The plugin README includes detailed instructions on enabling JSON-RPC for plugin servers and using the plugin window to interact with plugins.

@miki-totefu
Copy link
Collaborator

i don't know what you're trying to do

why isn't clientrpc sufficient?

@vctt94
Copy link
Contributor Author

vctt94 commented Jul 16, 2024

Hi miki,

Bison Relay has an internal package used solely for generating the gRPC interfaces: protoc-gen-go-svcintf https://github.com/companyzero/bisonrelay/tree/master/internal/protoc-gen-go-svcintf.

The problem is, I need the types.UnimplementedPluginServiceServer method generated from the gRPC protoc so I can add it to the PluginService I am creating: https://github.com/companyzero/bisonrelay/pull/597/files#diff-84dac2fbd5c005b8ae60645d21e5e20506cbc467a5020c1f148dfeda3fda8569R52

Otherwise, I get a compatibility error:

cannot use conn (variable of type *grpc.ClientConn) as "github.com/companyzero/bisonrelay/clientrpc/types".ClientConn value in argument to types.NewPluginServiceClient: *grpc.ClientConn does not implement "github.com/companyzero/bisonrelay/clientrpc/types".ClientConn (missing method Request)compilerInvalidIfaceAssign

The compatibility error is explained in the protoc README: https://github.com/grpc/grpc-go/blob/master/cmd/protoc-gen-go-grpc/README.md, and more information can be found in these issues: grpc/grpc-go#2318 and grpc/grpc-go#3669.

So it was suggested to create a new grpc .proto file, which worked

@miki-totefu
Copy link
Collaborator

i still don't understand what a plugin is supposed to do

is it code that third parties write and runs inside brclient? what about bruig? ppl write plugins will have to push prs to bisonrelay?

@vctt94
Copy link
Contributor Author

vctt94 commented Jul 17, 2024

Hey Miki, sorry about that. I added a README and a pluginserver_example.go to make it easier to understand how to create plugins.

  • Is it code that third parties write and runs inside brclient?
    Yes, plugins can be written by anyone interested in using br for its communication. A brclient enabling JSON-RPC listeners will allow connections to the plugin server. With that, other brclients will be able to connect to its plugin and call actions, as demonstrated in the README.

  • what about bruig?
    Flutter allows the creation of plugin packages: https://docs.flutter.dev/packages-and-plugins/developing-packages. I believe it might be possible to initiate plugins inside bruig with that, but I still need to do more investigation.

  • Will people writing plugins have to push PRs to BisonRelay?
    No, third-party plugins will be their own project and do not need to be pushed to BisonRelay. brclients will be able to interact with the plugins using gRPC and the BisonRelay network.

@vctt94 vctt94 force-pushed the start-plugins branch 2 times, most recently from 60c2885 to 36ec663 Compare July 23, 2024 18:47
@vctt94 vctt94 changed the title [wip] Initial Implementation of Plugins for Bison Relay Initial Implementation of Plugins for Bison Relay Sep 4, 2024
@vctt94 vctt94 closed this Oct 18, 2024
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.

2 participants