fix some type and change spring boot version to 2.0.1 from 2.0.0
This commit is contained in:
parent
0da695fba5
commit
6cbe92600d
|
@ -13,7 +13,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.0.0.RELEASE</version>
|
<version>2.0.1.RELEASE</version>
|
||||||
<relativePath /> <!-- lookup parent from repository -->
|
<relativePath /> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@ import reactor.core.publisher.Flux;
|
||||||
public class EventStreamController {
|
public class EventStreamController {
|
||||||
|
|
||||||
@GetMapping(value = "/events", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
@GetMapping(value = "/events", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
||||||
public Flux<Event> getMessages() {
|
public Flux<Event> getEvents() {
|
||||||
return Flux.interval(Duration.ofMillis(1000))
|
return Flux.interval(Duration.ofMillis(1000))
|
||||||
.map(tick -> new Event(tick, "This is Message #" + tick));
|
.map(tick -> new Event(tick, "This is Event #" + tick));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,12 +32,12 @@
|
||||||
var data = JSON.parse(event.data);
|
var data = JSON.parse(event.data);
|
||||||
var table = document.getElementById("events-table");
|
var table = document.getElementById("events-table");
|
||||||
var row = table.insertRow(1);
|
var row = table.insertRow(1);
|
||||||
var cell1 = row.insertCell(0);
|
var cellId = row.insertCell(0);
|
||||||
var cell2 = row.insertCell(1);
|
var cellBody = row.insertCell(1);
|
||||||
|
|
||||||
|
|
||||||
cell1.innerHTML = '<td>' + data.id + '</td>';
|
cellId.innerHTML = '<td>' + data.id + '</td>';
|
||||||
cell2.innerHTML = '<td>' + data.body + '</td>';
|
cellBody.innerHTML = '<td>' + data.body + '</td>';
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue