Giter Club home page Giter Club logo

spring-flights's Introduction

Spring Flights Application

This is a demo application showcasing RSocket support in Spring.

This application is made of 3 modules:

  • radar-collector, an app that provides information about radars and the aircraft signals they collect.
  • flight-tracker and flight-client, an app that displays an interactive map with radars and aircrafts.

Running the applications

First, run the collector application:

$ ./gradlew :radar-collector:build
$ java -jar radar-collector/build/libs/radar-collector-0.0.1-SNAPSHOT.jar

Then, run the tracker web application:

$ ./gradlew :flight-tracker:build
$ java -jar flight-tracker/build/libs/flight-tracker-0.0.1-SNAPSHOT.jar

The tracker application is available at http://localhost:8080/index.html

Radar Collector

This application is providing information about radars (actually populated from list of airports): their IATA code, location and aircraft signals recorded. The aircraft signals are randomly generated and the list of radars is inserted in a MongoDB database.

The application starts an RSocket server with TCP transport, at localhost:9898.

Currently you cannot use the rsocket-cli because it does not yet support composite metadata. However you can use the following tests...

TODO: link to tests for locate.radars.within and listen.radar.LYS

Flight Tracker

This application displays an interactive map showing radars - it is also concatenating the streams of aircraft signals for the radars displayed on screen.

The application starts a WebFlux server at localhost:8080, with an RSocket over websocket endpoint on /rsocket. The flight-client module builds the JavaScript client using Leaflet and the the websocket client from rsocket-js.

The browser will first locate all radars in the current view box; you can do the same on the CLI with:

rsocket-cli --stream \
--metadataFormat=application/vnd.spring.rsocket.metadata+json -m='{"route":"locate.radars.within"}' \
--dataFormat=json -i='{"viewBox": {"first":{"lng": 3.878915, "lat": 46.409025}, "second": {"lng": 6.714843, "lat": 44.365644}}, "maxRadars": 10}' \
--debug ws://localhost:8080/rsocket

Once all the radars are retrieved, we can ask a merged stream of all aircrafts for those radars to the server.

rsocket-cli --stream \
--metadataFormat=application/vnd.spring.rsocket.metadata+json -m='{"route":"locate.aircrafts.for"}' \
--dataFormat=json -i='[{"code":"LYS"}, {"code":"CVF"}, {"code":"NCY"}]' \
--debug ws://localhost:8080/rsocket

The browser will perform such a request and update the aircrafts positions live.

The Leaflet map has a small number input (bottom left) which controls the reactive streams demand from the client. Decreasing it significantly should make the server send less updates to the map. Increasing it back should catch up with the updates.

Also, once the RSocket client is connected to the server, a bi-directionnal connection is established: they're now both able to send requests (being a requester) and respond to those (being a responder). Here, this demo shows how the JavaScript client can respond to requests sent by the server.

Sending the following request to the web server will make it send requests to all connected clients to let them know that they should change their location to the selected radar:

curl -X POST localhost:8080/location/CDG

spring-flights's People

Contributors

bclozel avatar rwinch avatar rstoyanchev avatar

Stargazers

Camoufly avatar Somnath Musib avatar Kempfer Hugo avatar Marcelo Balloni avatar Ben Wilcock avatar Hantsy Bai avatar abhishek.saware avatar Martin avatar sitakant avatar A. Brandell avatar Anel avatar

Watchers

Ray Suliteanu avatar  avatar

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.