If you want to probe what encodings a VNC server supports, here's a rudimentory method. Run the below script (following the notes), subbing out the first encoding you pass in the array.
If it's not supported, you'll see an encoding log of 0 (the server fell back to raw). Otherwise you'll see the encoding you specified (or an error from rfb2 because it doesn't know how to deal with it, but that's fine).
https://chatgpt.com/share/692dfd34-f3ec-8013-a45a-4abb5506964c has some thoughts on "desirable" protocols. My sense is that ZRLE is the most modern standard for lossless. Tight might be a faster lossy alternative. H264 is probably awesome, but good luck finding a VNC server that supports it.
const rfb = require("rfb2");
// MODIFY: rfb2/rfbclient.js readFbUpdate() to log the rect.encoding when received