event-source-sample in Kotlin
Kotlin
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
README.md
pom.xml

README.md

Kotlin Event Source Example

A small example on how to use EventSource aka Server-Sent Events with Kotlin.

You need jetty-eventsource-servlet (released to Maven Central) then go to http://127.0.0.1:8080/kotlin-event-source-sample/ and you see the server time that gets updated all ten seconds. Not very useful but shows you how to use the API.

Building

You need to have the JetBrains repository in your settings.xml or proxy repository manager.

<repositories>
    <repository>
        <id>jetbrains-all</id>
        <url>http://repository.jetbrains.com/all</url>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>jetbrains-all</id>
        <url>http://repository.jetbrains.com/all</url>
    </pluginRepository>
</pluginRepositories>

Tomcat

To make the example work on Tomcat you need Tomcat 7 and have a NIO connector.

<Connector protocol="org.apache.coyote.http11.Http11NioProtocol" />

Check out the the HTTP Connector reference for more information.

It's recommended that you use Tomcat 7.0.28 or newer otherwise you'll get chunking.

Resin

Does chunking but works out of the box.

GlassFish

Needs a not yet released version or a manual patch, see GRIZZLY-1252

Jetty

Works out of the box, even on Jetty 7.