Skip to content

Commit c27e60d

Browse files
committed
Fixes
1 parent d5ba8c6 commit c27e60d

File tree

4 files changed

+3915
-853
lines changed

4 files changed

+3915
-853
lines changed

raspberry-pi/cl_seq/index.js

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
const { PassThrough } = require("stream");
21
const ws = require('ws');
2+
const PassThrough = require('stream');
33

44

5+
const topic = "topic";
56

6-
module.exports = [
7-
{ requires: "pipe", contentType: 'text/plain' },
8-
function(input) {
9-
const client = new ws('ws://localhost:3000');
10-
const out = new PassThrough({ objectMode: true });
7+
module.exports = async function (input){
8+
const client = new ws('ws://localhost:3000');
119

12-
async function reader(client) {
13-
for await (const chunk of input) {
14-
client.send(chunk);
15-
}
16-
}
17-
client.on('open', () => {
18-
reader(client);
19-
});
20-
10+
async function reader(client) {
11+
for await (const chunk of input) {
12+
client.send(chunk);
13+
}
14+
}
2115

22-
return out;
23-
}
24-
];
16+
client.on('open', function open() {
17+
client.send('something');
18+
});
19+
20+
21+
client.on('message', function message(data) {
22+
console.log('client received: %s', data);
23+
});
24+
25+
return input;
26+
}

0 commit comments

Comments
 (0)