Nakilon's blog

WSUI -- websockets-based HTML GUI framework for Ruby runtime

I switched from C++ Builder to Ruby ~15 years ago. Since then I often miss the ability to make my runtime objects visible and interactable. There were fxWidgets, wxWidgets, tk, Qt, then ruby2d, DragonRuby and even some JWT based toolkit but all this either didn't work at all for different reasons or was tedious. I even made a REPL-compatible wrapper for ruby2d ~3 years ago but then some ruby2d multithreading issues were on the way to implement my further ideas and I stopped.
But recently I've discovered the p5.js framework that is now my tool of a choice to visualize things, and few days ago I stumbled upon some websockets addition to it, and it gave me an idea to try to implement one of those old Ruby UI desires. Gluing this all together was pretty trivial and took like one evening. I called the gem "WSUI" and made a basic example:

This morning for another example I've added a simple Tic Tac Toe game implementation -- you can see it on YouTube.
I am thinking of other applications, such as a click-driven website crawler or maybe even a DOM navigator -- anything that you usually just rerun.

#GUI #Ruby #gem wsui #websockets