diff --git a/Makefile b/Makefile index 1bf1adb..c0a8ac2 100644 --- a/Makefile +++ b/Makefile @@ -12,8 +12,8 @@ build-dev: test: install-wasm-pack wasm-pack test --firefox --headless -fluvio-websocket-proxy: - cargo run -- ./fluvio-websocket-proxy/Cargo.toml +run-fluvio-websocket-proxy: + cargo run --manifest-path ./fluvio-websocket-proxy/Cargo.toml webpack-dev: npm install diff --git a/README.md b/README.md index b29a267..7fbd837 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This project is currently setup to be used via rollup. Setup fluvio with a `--local` cluster installation locally then run the following: -* `make fluvio-websocket-proxy` +* `make run-fluvio-websocket-proxy` ### Hot Reloading To use hotreloading for the contents of diff --git a/js/index.js b/js/index.js index 7ed51da..c841969 100644 --- a/js/index.js +++ b/js/index.js @@ -1,22 +1,53 @@ import("../pkg").then(async fluvioWasm => { var Fluvio = fluvioWasm.Fluvio; var Offset = fluvioWasm.Offset; - const fluvio = await Fluvio.connect("ws://localhost:3000") - const producer = await fluvio.topicProducer("foobar"); - await producer.send("", `count`); + while (true) { + try { + const fluvio = await Fluvio.connect("ws://localhost:3000") + const producer = await fluvio.topicProducer("foobar"); + await producer.send("", `count`); - const consumer = await fluvio.partitionConsumer("foobar", 0); - let stream = await consumer.stream(Offset.fromEnd(10)) + const consumer = await fluvio.partitionConsumer("foobar", 0); + let stream = await consumer.stream(Offset.fromEnd(1)) + const userAgent = navigator.userAgent; - let count = 0; - let before = new Date(); - while (count < 10) { + let count = 0; + let before = new Date(); + while (count < 10000) { - await producer.send("", `count-${count}`); - let next = await stream.next(); - console.log(`${next.keyString()} - ${next.valueString()}`); - count++; + try { + await producer.send("", `${count}-${userAgent}`); + let next = await stream.next(); + let text = `${next.valueString()}`; + console.log(text); + document.body.innerHTML = + `