Files
spring-boot-rest/spring-data-5-reactive/src/main/resources/static/index.html
Jorge c32bbe3be7 [Bael 1687] - Spring Data Reactive Mongo DB microservice in Kotlin (#3993)
* [BAEL-1641] Find all pairs of numbers in an array that add up to a given sum

* Commiting editor's suggested changes

* Commiting article Spring Data Reactive Mongo DB microservice in Kotlin

* Revert commit for BAEL 1687 - Moving those files to a new branch

* [BAEL-1687] - Real-time data streaming using Reactive MongoDB and Kotlin

* Reverting changes [BAEL-1641] - Not from this branch

* [BAEL-1687] - Code Peer Review - Added suggested changes
2018-04-16 21:09:15 +02:00

34 lines
940 B
HTML

<html>
<body>
<form method="get" action="/saveEvent">
<input type="text" name="eventName">
<button type="submit">Save new event</button>
</form>
<!-- Here will be painted each new received Server-Sent event's content-->
<div id="content"></div>
<script>
var source = new EventSource("receiveChanges");
source.addEventListener('message', function (e) {
console.log('New message is received');
const index = JSON.parse(e.data);
const content = "New event added: " + index.name + "<br>";
document.getElementById("content").innerHTML += content;
}, false);
source.addEventListener('open', function(e) {
console.log('The connection has been opened');
}, false);
source.addEventListener('error', function(e) {
if (e.readyState == EventSource.CLOSED){
console.log('The connection has been closed');
}
}, false);
</script>
</body>
<html>