Streaming PDF.js view to multiple people via node.js and socket.io?

There's a very popular PDF.js library on GitHub that lets you upload/view PDF files from the browser.

Demo: http://mozilla.github.com/pdf.js/web/viewer.html

First of all is it possible to stream in real-time my local PDF file to multiple clients that would connect to my website? Secondly, can I do it without modifying the PDF.js source code?

Ideally, all users should see the same page with gray background indicating no PDF is loaded. Then any one user can upload a PDF. When that user upload a pdf file, it should be displayed for all other connected users right away.

What's the simplest brute-force solution to this?

You have to modify at least viewer.js (and viewer.html). Let's take an existing chat program as a base, e.g. http://psitsmike.com/2011/09/node-js-and-socket-io-chat-tutorial/

To keep viewer empty at start, remove: PDFView.open(file, 0); line in webViewerLoad().

Send the pdf data to the chat instead of opening in the viewer immediately: in webViewerChange() replace PDFView.open(uint8Array, 0); with code that will send btoa(bytesToString(uint8Array)) to the "chat". When the open-document-message from the chat is received you can process it the following way: PDFView.open(stringToBytes(atob(data)), 0);

Now navigation: if the viewer is a master, send pdfOpenParams in updateViewarea() to the "chat". On the slaves, execute navigate-message as PDFView.setHash(hash.substring(1));

Hopefully that helps.