hypersource
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "hypersource", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Build WebSocket APIs that leverage the HyperCore Protocol", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -63,6 +63,2 @@ const { Duplex } = require('readable-stream') | ||
if (this.stream) { | ||
process.nextTick(pump, this, this.stream, this) | ||
} | ||
if (opts.socket && 'function' === typeof opts.socket.send) { | ||
@@ -111,5 +107,5 @@ process.nextTick(() => this._onOpen()) | ||
userData: this.userData, | ||
download: true, | ||
upload: true, | ||
live: true, | ||
download: this.download, | ||
upload: this.upload, | ||
live: this.live, | ||
}) | ||
@@ -116,0 +112,0 @@ |
13
test.js
@@ -20,3 +20,2 @@ const WebSocket = require('simple-websocket') | ||
reader.replicate(req) | ||
writer.replicate(res) | ||
@@ -28,3 +27,7 @@ writer.once('upload', () => { | ||
reader.get(0, (err, buf) => writer.append(buf)) | ||
reader.get(0, (err, buf) => { | ||
writer.append(buf, () => { | ||
setTimeout(() => writer.replicate(res), 1000 * Math.random()) | ||
}) | ||
}) | ||
}) | ||
@@ -47,6 +50,8 @@ | ||
request.append('hello world') | ||
const buf = Buffer.alloc(612444 * 2) | ||
buf.fill(Buffer.from('hello world')) | ||
request.append(buf) | ||
response.replicate({ stream, live: true }) | ||
response.get(0, (err, res) => { | ||
t.equal('hello world', res.toString()) | ||
t.ok(0 === Buffer.compare(buf, res)) | ||
socket.destroy() | ||
@@ -53,0 +58,0 @@ server.close() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20222
474