A plugin for rjsv that starts a local WebSocket server and allows
external applications to monitor the file transpilation state.
The server sends a notification whenever transpilation finishes, so other tools can react to changes (e.g. live reload, build automation, etc.).
The plugin requires the em-websocket Ruby gem
(which automatically installs eventmachine as a dependency):
gem install em-websocketRecommended installation: place the plugin in your $HOME/.rjsv/plugins directory.
For more details, see the official documentation: Plugins
The plugin is enabled by adding the websocket argument
to the end of the rjsv command.
It is recommended to place it at the end so that subsequent flags are processed by the main application instead of the plugin.
The WebSocket server starts only when file watching (watch mode) is enabled.
rjsv -t -w -s 'src/rb' -o 'src/js' websocketAfter startup, a local WebSocket server runs at:
ws://localhost:7071When transpilation completes, the server sends the following message to all connected clients:
{ "type": "update" }- frontend live reload
- build process synchronization
- integration with developer tools
┌───────────────────────┐
│ RJSV::CLI::States │
│ (watch_state) │
└─────────┬─────────────┘
│ tracks files
▼
┌───────────────────────┐
│ File System Events │
│ (added, modified, │
│ removed) │
└─────────┬─────────────┘
│ trigger
▼
┌─────────────────────────────┐
│ RJSV::Plugins::Websocket │
│ States │
│ (create_server, send_update)│
└─────────┬───────────┬───────┘
│ │
│ send │ server lifecycle
▼ ▼
┌─────────────────────────────┐
│ WebSocket Server │
│ (ws://localhost:7071) │
└─────────────────────────────┘
│
│ notification "update"
▼
┌─────────────────────────────┐
│ Connected Clients / Tools │
│ (live reload, build sync) │
└─────────────────────────────┘This diagram shows how the CLI, WebSocket plugin, server, and connected clients interact.