Closed moshest closed 7 years ago
Using express-ws module:
express-ws
const express = require('express'); const expressWebSocket = require('express-ws'); const websocketStream = require('websocket-stream/stream'); const app = express(); // extend express app with app.ws() expressWebSocket(app, null, { perMessageDeflate: false, }); app.ws('/bigdata.json', function(ws, req) { const stream = websocketStream(ws, { binary: true, }); fs.createReadStream('bigdata.json').pipe(stream); }); app.listen(3000);
Can you send us a PR?
Please see #132.
Using
express-ws
module: