| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,13 +24,24 @@ <h1>BinaryJS</h1> | |||
| 24 | 24 | </header> | |
| 25 | 25 | ||
| 26 | 26 | <section> | |
| 27 | - | ||
| 27 | + <h3>Show me the API</h3> | ||
| 28 | + <p>BinaryJS allows multiple streams over a single realtime websocket connection. Either the client or server can create a stream and both client and server can write to it once created.</p> | ||
| 29 | + <pre><code> | ||
| 30 | + var server = BinaryServer({port: 9000}); | ||
| 31 | + server.on('connection', function(client){ | ||
| 32 | + client.on('stream', function(stream){ | ||
| 33 | + var w = fs.createWriteStream(stream.id+'.txt'); | ||
| 34 | + stream.pipe(w); | ||
| 35 | + }); | ||
| 36 | + }); | ||
| 37 | + </code></pre> | ||
| 38 | + | ||
| 28 | 39 | <h3>Binary data for the web is here</h3> | |
| 29 | 40 | <p>A year ago if someone asked you "how do I stream binary data / audio / video / files to Javascript", the answer was "Flash" or "no" (or "Java applets") </p> | |
| 30 | 41 | <p>But as of Chrome 15+, Firefox 11+, Internet Explorer 10, and Safari nightly builds, that is no longer true.<p> | |
| 31 | 42 | <p>BinaryJS is a light but comprehensive framework utilizing websockets to:</p> | |
| 32 | 43 | <ul> | |
| 33 | - <li>Send, stream, or pipe binary data between web clients and Node.js</li> | ||
| 44 | + <li>Send, stream, or pipe binary data between web javascript and Node.js</li> | ||
| 34 | 45 | <li>Data is never stringified. Everything is only ever binary</li> | |
| 35 | 46 | <li>BinaryPack serialization is included and fully JSON compatible</li> | |
| 36 | 47 | <li>Multiplexed websocket streams. A client and server can send any number of streams to each other</li> | |
@@ -45,12 +56,11 @@ <h3>What can you do with this?</h3> | |||
| 45 | 56 | <li>Streaming FLAC into HTML5 WebAudio api</li> | |
| 46 | 57 | <li>Progressive image loading (for retina displays and high-res photorgraphy)</li> | |
| 47 | 58 | <li>Multiplayer video games without expensive stringifying</li> | |
| 59 | + <li>Streaming file uploads (see example)</li> | ||
| 48 | 60 | <li>Live HTML <video> streaming</li> | |
| 49 | 61 | <li>PJAX with no http requests. Not even for image assets.</li> | |
| 50 | 62 | <li>Video / audio chat over websockets</li> | |
| 51 | 63 | </ul> | |
| 52 | - <h3>Show me the API</h3> | ||
| 53 | - <p>The BinaryJS allows multiple streams over a single socket connection. Either the server and create a stream and both client and server can write to it once created.</p> | ||
| 54 | 64 | ||
| 55 | 65 | <!-- | |
| 56 | 66 | <h3>Welcome to GitHub Pages.</h3> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments