Handling the file-sharing signals on the server
As in the audio call only and text chat examples, yet again we can see that the abstract design of the WebSocket based signaling server requires almost no updates to support file sharing.
The primary change allows us to handle serving image files from an images/directory so we can include the Share a new file button image and the new file-arriving placeholder image.
// web server functions var http_server = http.createServer(function(request, response) { var matches = undefined; if (matches = request.url.match("^/images/(.*)")) { var path = process.cwd()+"/images/"+matches[1]; fs.readFile(path, function(error, data) { if (error) { log_error(error); } else { response.end(data); } }); } else { response.end(page); } });
The only other change required is to update the name of the source HTML file it reads in using the fs
package to video_call_with_chat_and_file_sharing.html
to match our new...