While RCWeb provides a robust and innovative framework for real-time distributed applications via shared JavaScript execution, there are always avenues for enhancement. This document explores potential platform improvements and theoretical examples showcasing the versatility of RCWeb technology.
eval() can be risky if a
malicious actor accesses the room. The core comms.js could evaluate incoming scripts within
an isolated Web Worker or a sandboxed <iframe> that has restricted access to the main
thread's DOM and cookies.abcd-efgh), preventing unwanted
participants from listening to or broadcasting commands."app.doAction('" + id + "');") is prone to syntax errors. A proxy wrapper could allow
developers to seamlessly call remote functions natively returning Promises (e.g.,
rc.remote('viewer').app.doAction(id)).d.ts files for the global rc
object and standard callback signatures to improve autocompletion and static type checking in IDEs.The following examples help demonstrate the vast potential and versatility of the RCWeb framework when applied to different domains.
Concept: A presenter opens the master "Slides" view on a large screen or projector. The audience joins the room on their smartphones, automatically adopting an "audience" type.
Execution: The presenter sends JavaScript commands that smoothly transition slides using CSS animations on all screens simultaneously. At any time, the presenter triggers a command rendering a multiple-choice poll button on audience devices. When an audience member clicks a choice, they send a command back to the master view, tallying and visualizing a live D3.js chart in real-time.
Why RCWeb: Eliminates the need for traditional database polling and separate audience engagement platforms like Kahoot or Mentimeter. It is completely standalone and instantaneous.
Concept: A computationally expensive task (like rendering a complex fractal, training a neural network model, or hashing a large dataset) is split into chunks.
Execution: The host client broadcasts a small JavaScript worker function to all
connected peers in the room via rc.send(). Each peer is assigned a specific data chunk to
process. The connected browsers act as a distributed computing cluster, processing their chunks locally
utilizing their own CPU power. Upon completion, each peer transmits the solved output back to the host,
who stitches the final dataset together.
Why RCWeb: Turns transient web browsers into a dynamic, parallelized supercomputer without installing any client software.
Concept: A step beyond a basic pixel graffiti app, this involves a synchronized SVG or Canvas-based vector design tool.
Execution: Users can drag nodes, draw Bezier curves, add sticky notes, and type text.
Every interaction (like onMouseMove while dragging a shape) instantly broadcasts
parameterized function calls to peers (e.g., board.moveShape('rect1', x, y)). If a user
joins late, a debounce method prompts a connected peer to serialize the entire vector state as a string
and execute a full re-render command on the new user's browser.
Why RCWeb: Provides a Figma-like real-time editing experience using incredibly minimal backend infrastructure.
Concept: A 2D top-down roleplaying game built using HTML Canvas and a game loop.
Execution: The room address acts as the game server (e.g., TownSquare).
There is no "host"; the game state is a shared delusion. Player 1 moves and broadcasts their X/Y
coordinates; Player 2's browser executes the script to update Player 1's animated sprite locally. If
Player 1 drops an item, an eval() script spawns the item globally across all clients.
Collision and combat rules are enforced purely client-side by synchronized JS.
Why RCWeb: Demonstrates a "serverless backend" architecture natively supporting persistent, stateful, peer-to-peer MMORPG capabilities purely through browser JavaScript.