vecty icon indicating copy to clipboard operation
vecty copied to clipboard

wrapping for embedding in mobile and desktop apps

Open joeblew99 opened this issue 8 years ago • 3 comments

i know this is very high level but figured it was worth bring up here.

I have been looking into how we can make Desktop and Mobile apps and sign them too. There are a few libs around to help, but no one has really brought it together yet.

I there any interest in this or idea how best to do it ?

My current thinking is... Golang backend (on mobile):

  • use gomobile bind, and export a binary API.

Native webview (a bit of ios and android code):

  • This creates a the web view api, withe the right commands to expose it to the golang frontend as Javascript and back again.
  • The binary commands need to pass through so we don't have to write a tons of boiler plate ios and android code.

Golang frontend:

  • vecty etc, but essentially a big elect statement for each possible command statement and then route it appropriately.

It could be that protobufs are a perfect solution here because its binary and because there are very good code generators around it. Its probably too early to tell though.

Has anyone else looked into this ?

joeblew99 avatar Jul 02 '17 20:07 joeblew99

I can imagine a world in which Vecty might provide easy integration with a separate project that handles all of the difficult bits (i.e. a project that handles setting up a webview using Android/iOS/Electron APIs). This would primarily be some sort of 'vecty' CLI tool which would manage compiling go to js, packaging assets, etc.

As far as getting an actual cross-platform webview on android/ios/desktop.. that's obviously outside the scope of vecty itself. And I cannot imagine why such a project would be inherently tied to vecty, after all it should work with any HTML/JS/CSS code.

emidoots avatar Jul 03 '17 03:07 emidoots

@slimsag your right - it should not be tied to vecty at all.

The Vecty CLi is a good way of putting it. Most of the code can be generated. This is because you want a DB down there and need data flowing between the UI and DB layer. That code is almost all boilerplate that can be generated.

The other thing is just holding the webview. At the moment i am getting good success with Ebiten. This is a 2D game engine but has good infrastructure for bring up and signing n all Desktops and Mobiles right now. Adding a Webview and the boiler plate signalling is a definite smart move.

Alul3D also might be good. you work on that. Does it have a good infra setup fro mobile and desktop ?

joeblew99 avatar Jul 21 '17 12:07 joeblew99

@joeblew99 I have a feeling any game engine and web app in general will have very different setup requirements. I'm also not aware of any game engine in Go today that has a good mobile story (including gomobile, although that isn't really a game engine).

Today I was trying to achieve something like this issue with a Vecty app of my own, and what I considered is that having something which could:

  1. Take a Vecty / GopherJS application as input and (2)
  2. Produce a truly-cross-platform (Windows, Mac & Linux via Electron, Android & iOS via their native WebView's)

Would be quite nice. The tricky part is how to actually do that. The Mac and iOS parts introduce the most complexity, mainly because you must have a mac to develop for those generally. It'd be great if that wasn't the case.

I think what we could do is one of two things:

  1. Ask for users to download the mac installer from the app store, and then start and control a mac virtual machine on their own hardware via qemu with KVM extension, inside of a docker container so there would be basically no work involved. https://github.com/Cleafy/sxkdvm is one such project which does this (we would just need to write the actual application packaging on top of this).
  2. Easier, if we can get away with it in all aspects, offer a Docker image which could package for each OS respectively. This would mean:
  3. Windows/Mac/Linux would be packaged via https://www.npmjs.com/package/electron-packager inside the Docker image.
  4. Because Docker only runs Linux, we would have to try getting https://github.com/saucelabs/isign to work with signing the Mac & iOS applications.
  5. For Android and iOS, we would build an application which would essentially just be a webview + packaged up index.html and bundle.js file (+ maybe other assets?), and would expose whatever APIs we wanted (e.g. to create notifications). We would then save this as an apk or app file, and the Docker image itself would only open this file, replace the relevant information (settings files regarding app name & author info etc, and data files like index.html and bundle.js) and then sign the file once again using the relevant certificate.

In theory what this would be like is essentially having a user install Docker first and then run:

vecty package ./my/go/package

And it producing an app file for every important desktop + mobile OS.

Nothing concrete here, maybe there are obvious issues I am missing, but if we could get that to work I think it'd be a great thing to include in a Vecty CLI tool in the long run.

emidoots avatar Dec 04 '17 06:12 emidoots