The RCWeb Files App (app/files) is a distributed, real-time file sharing application within the RCWeb ecosystem. It demonstrates the Symmetric Pattern, enabling multiple users connected to the same virtual room to securely share and transfer files directly over a peer-to-peer style network without relying on central server storage.


The core logic resides in script.js and leverages the RCWeb comms.js communication framework.
dragEnter, drop). These local File objects are stored in the files array memory. The promptExit() function prevents accidental closing of the tab, which would sever the file streams.broadcastFileList() executes, the app dynamically constructs safe proxy URLs (e.g., /x-file/room/client/fileId/fileName). It creates a JavaScript string of fs.addFileLink(...) execution commands and broadcasts it via rc.send(listJs, "files"). When evaluated on remote peers, this updates their UI with download links.rc.sendFileChunk(fileId, start, url) callback on the user who originally shared the file. The app slices the requested segment from the local File blob.XMLHttpRequest (XHR) HTTP PUT operation with specific headers (Content-Type, Content-Range) in sendChunk().rc.onUpdateClients(clients). Whenever a new participant emerges in the connection pool, it triggers fs.requestRefresh(). The room coordinates a debounced fs.refresh() cycle, ensuring the new entrant receives the full broadcastFileList() payload from all active seeders without spamming the network.