Why Wails?

It’s a framework that greatly simplifies the differences when attempting to develop cross-platform desktop applications.

And it has strengths that make it a promising candidate when comparing against ElectronJS such as the fact that it’s extremely lightweight.

Architecture

Pros

Easy to Get Started

The default project structure is pretty simple so it is easier to understand for beginners who are just getting into it.

A major advantage that Wails has over ElectronJS is that there are no further optimizations that are necessary to get the bundle size smaller or anything like that.

With ElectronJS the initial bundle size is huge and you need to configure it properly to get the bundle size down.

Lightweight

Applications can be extremely small in size since they use the WebView of the operating system itself, unlike Electron which packs the browser too.

Performance

Offloading complicated operations to the back-end running on GoLang gives huge performance benefits as compared to a framework like ElectronJS. The developer can also make use of multiple threads when using Golang.

Limitations & Problems

No Web Communication from Front-End/JS

Wails has this limitation where the front-end cannot directly communicate with any web servers except for the local back-end server within Wails itself. This could be a limitation of WebView and limitations of operating systems (needs to be further looked into).

One way around this is to write an endpoint in the back-end which acts as a proxy to send out requests to the Internet. The front-end can then use this endpoint to contact any web servers.

Lack of support for Sockets

A big problem I ran into while developing some of my apps are the lack of support for socket communication between the JavaScript front-end and the Golang back-end.

Let’s take a scenario where you have been given a task computationally expensive enough that it has to be done in the GoLang back-end, but you must display the progress of that task on the front-end.

The only option you have as a developer is to use the “Polling” strategy since using socket communication is not supported. When implementing Polling you run into several other issues, such as the frequency of polling to accurately display the progress to the user but you also have to keep in mind not to overwhelm the back-end with polling requests.

Use cases that benefit from sockets which aren’t supported in Wails

  1. Real-time notifications
  2. Chat applications
  3. Video/Audio streaming
  4. Multiplayer games

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *