Skip to content

Commit

Permalink
add support for openStream data (#158)
Browse files Browse the repository at this point in the history
Signed-off-by: Jari Kolehmainen <[email protected]>
  • Loading branch information
jakolehm authored Jan 5, 2022
1 parent 39a2b8c commit 6be6619
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"dependencies": {
"@sentry/node": "^6.15.0",
"bored-mplex": "^0.0.17",
"bored-mplex": "^0.0.20",
"jsonwebtoken": "^8.5.1",
"ws": "^7.4.6"
}
Expand Down
8 changes: 4 additions & 4 deletions src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export class Agent {
addClient(socket: WebSocket, userId: string) {
this.clients.push({ socket, userId });

const mplex = new BoredMplex((stream) => {
const agentStream = this.openStream();
const mplex = new BoredMplex((stream, data) => {
const agentStream = this.openStream(data);

stream.pipe(agentStream);
agentStream.pipe(stream);
Expand Down Expand Up @@ -113,7 +113,7 @@ export class Agent {
console.log("SERVER: client disconnected");
}

openStream() {
return this.mplex.openStream();
openStream(data?: Buffer) {
return this.mplex.openStream(data);
}
}
7 changes: 4 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -979,9 +979,10 @@ binary-extensions@^2.0.0:
version "2.2.0"
resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz"

bored-mplex@^0.0.17:
version "0.0.17"
resolved "https://registry.npmjs.org/bored-mplex/-/bored-mplex-0.0.17.tgz"
bored-mplex@^0.0.20:
version "0.0.20"
resolved "https://registry.yarnpkg.com/bored-mplex/-/bored-mplex-0.0.20.tgz#8f64ad23d605751a1ca2ff3e07d5e808c27962ef"
integrity sha512-1kzzE6qe8ugO8RVswgzZue28YtZBMlpY/J0XICQmYr/h0RxIn76ZtMVWDF0drVfdISyw49nFqphQ2v5DagpKIA==
dependencies:
msgpackr "1.2.9"

Expand Down

0 comments on commit 6be6619

Please sign in to comment.