hantsy / angular-spring-websocket-sample

Demo for using Angular and Spring Reactive WebSocket together

Home Page:https://medium.com/@hantsy/building-a-chat-application-with-angular-and-spring-reactive-websocket-400e0769f4ec

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

angular-spring-websocket-sample

This sample is to demonstrate a chat application using the following cutting-edge technology stack :

  • Angular as WebSocket client
  • Spring WebFlux based Reactive WebSocket APIs
  • In-memory Reactor Sink as a message queue(feat/reactor-sinks branch) or
  • Spring Data MongoDB based @Tailable query result as an infinite stream

Prerequisites

  • NodeJS 14
  • OpenJDK 14
  • Docker for Windows(or Mac if you are a MacOS user)

Build

Before running the application, you should build and run client and server side respectively.

Server

Run a MongoDB service firstly, simply you can run it from a Docker container. There is a docker-compose.yaml file is ready for you.

docker-compose up mongodb

Build the application.

./gradlew build

Run the target jar from the build folder to start up the application.

java -jar build/xxx.jar

Client

Install dependencies.

npm install

Start up the application.

npm run start

Now you can open a browser and navigate to http://localhost:4200 and have a try.

Reference

About

Demo for using Angular and Spring Reactive WebSocket together

https://medium.com/@hantsy/building-a-chat-application-with-angular-and-spring-reactive-websocket-400e0769f4ec

License:GNU General Public License v3.0


Languages

Language:TypeScript 45.0%Language:Kotlin 37.0%Language:JavaScript 10.9%Language:HTML 6.1%Language:CSS 1.0%