.port(0) .handle((req, res) -> res.options(NettyPipeline.SendOptions::flushOnEach) .sendWebsocket((in, out) -> out.sendString(Flux.interval(Duration.ofSeconds(1))
.port(0) .handle((req, res) -> res.options(NettyPipeline.SendOptions::flushOnEach) .sendWebsocket((in, out) -> out.sendString(Flux.interval(Duration.ofSeconds(1))
.addHeader("Cache-Control", "no-cache") .addHeader("Connection", "close") .options(NettyPipeline.SendOptions::flushOnEach) .send(bufferStream.doOnNext(d -> integer.getAndIncrement()) .take(takeCount)
private void setupFakeProtocolListener() { broadcaster = TopicProcessor.create(); final Processor<List<String>, List<String>> processor = WorkQueueProcessor.<List<String>>builder().autoCancel(false).build(); Flux.from(broadcaster) .buffer(5) .subscribe(processor); httpServer = HttpServer.create() .port(0) .route(r -> r.get("/data", (req, resp) -> resp.options(NettyPipeline.SendOptions::flushOnEach) .send(Flux.from(processor) .log("server") .timeout(Duration.ofSeconds( 2), Flux.empty()) .concatWith(Flux.just( new ArrayList<>())) .map(new DummyListEncoder( resp.alloc() ))))) .wiretap(true) .bindNow(); }
HttpServer.create() .port(0) .handle((in, out) -> out.options(NettyPipeline.SendOptions::flushOnEach) .sendString(Mono.just("test") .delayElement(Duration.ofMillis(100))
req.receive() .then(res.compression(true) .options(op -> op.flushOnEach()) .sendString(ep.log()).then()))) .wiretap(true)
.get("/stream", (req, res) -> req.receive() .then(res.options(op -> op.flushOnEach()) .sendString(ep.log()).then()))) .wiretap(true)