Calling an RPC via websocket from a browser using javascript

While using Mongoose OS on an ESP32, I’m trying to call RPC like FS.Get via a websocket from javascript running in a browser. I have found man examples of how to do this from mos but I can’t seem to make it work writing plain JS (on the client browser). Is there a simple example of how to call an RPC this way?

Example here