List of usage examples for org.springframework.http.codec ServerSentEvent builder
public static <T> Builder<T> builder(T data)
From source file:top.zhacker.ms.reactor.webflux.controllers.SseController.java
@GetMapping("/sse/event") Flux<ServerSentEvent<String>> event() { return Flux.interval(Duration.ofSeconds(1)) .map(l -> ServerSentEvent.builder("foo\nbar").comment("bar\nbaz").id(Long.toString(l)).build()); }
From source file:top.zhacker.ms.reactor.webflux.controllers.SseController.java
@PostMapping("/sse/receive/{val}") public void receive(@PathVariable("val") String s) { replayProcessor.onNext(ServerSentEvent.builder(s).build()); }