Giter Site home page Giter Site logo

micronaut-sse-rxjava's Introduction

micronaut-sse-rxjava

Micronaut example event flow to SSE

Steps to exercise the example:

  1. ./gradlew run
  2. Open localhost:8080 in any non IE browser
  3. curl -X POST -d '{"name":"John"}' -H "Content-Type: application/json" http://localhost:8080/author/publish
  4. View the event was received and output to the page

Explanation:

Static resources is used to render an index.html page when accessing the root / URL. That page also brings in an sse.js file that uses the standard Server Sent Event API in JavaScript to listen for events and display them on the page.

An AuthorService is responsible for allowing subscribers to a stream of Author objects. The AuthorController returns a modified stream that wraps each author into an Event. An endpoint on the AuthorController allows Author objects to be sent via JSON and added onto the stream. Anywhere else in the code the AuthorService could be used to publish events. Anywhere else in the code one could subscribe to those events and receive Author objects.

micronaut-sse-rxjava's People

Contributors

jameskleeh avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

antondelpiero

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.