miketheprogrammer / go-thrust

Cross Platform UI Kit powered by Blink/V8/Chromium Content Lib
MIT License
445 stars 34 forks source link

JS <==> Go RPC Bridge #28

Closed miketheprogrammer closed 9 years ago

miketheprogrammer commented 9 years ago

We need an RPC Bridge. This may possibly require a rewrite to the structure of the Bindings(menu, window, session), allowing channels to be returned. I am not sure if this is the best route yet.

Another method would be to Register the RPC module with the Dispatcher, and allow the dispatcher to dispatch to the Frontend, and allow the frontend to handle any reactions there.

Current Working Branch: https://github.com/miketheprogrammer/go-thrust/tree/package/web_jsonrpc

miketheprogrammer commented 9 years ago

Correction: We dont know if we are going to build this into the core.

tehbilly commented 9 years ago

Is this what was talked about in gitter? Where we determined that a simpler solution for this would be to write your handlers in go and access them directly from the application's js?

spolu commented 9 years ago

By JS you mean JSON ?

tehbilly commented 9 years ago

I'm referring to javascript, not json. Assuming the content of the thrust-powered application is standard web content, you can simply use javascript to communicate with the go backend like you would any other http server. And then the existing go libraries/methodologies would be able to tie in as if you're writing a normal webserver.

The biggest possibility I see for thrust helping this process is having thrust provide a way for the application to know where the backend is "located", perhaps. Attaching an object to window that defines properties the backend can set.

spolu commented 9 years ago

I'm adding a remote objcect in the main javascript context to send and receive message with the backend app

miketheprogrammer commented 9 years ago

As spolu mentioned, "remote" in Thrust, available to the frontend, will allow us to do rpc. Closing. Reopen as Implement Remote ticket when new version is released