https://github.com/valery1707/test-websocket
https://github.com/valery1707/test-websocket
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/valery1707/test-websocket
- Owner: valery1707
- Created: 2016-03-28T13:19:48.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-01T09:13:10.000Z (about 9 years ago)
- Last Synced: 2025-01-23T05:24:00.569Z (3 months ago)
- Language: Java
- Size: 123 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://travis-ci.org/valery1707/test-websocket)
[](https://coveralls.io/github/valery1707/test-websocket?branch=master)Simple project for work with Websocket: `spring-boot`, `jetty-embedded`
### Explanation of technology choice:
1. Build system
* Alternatives: Maven, Gradle, ANT, SBT
* Selected: Gradle
* Reason: Gradle is declarative build system for Java project (same as Maven), that designed to build not only Java projects, and have many possibilities for change behavior of build process
1. Embedded servlet container
* Alternatives: Tomcat embedded, Jetty
* Selected: Jetty
* Reason: Jetty has less footprint (~ 1.4 MiB, ~ 1.7 MiB with websocket implementation) than Tomcat (~ 2.7 MiB, 2.9 MiB with websocket implementation)
1. WebSocket connection mode: in test client (JavaScript) and server simultaneously implemented two modes (pure websocket connection, and Sock.JS+STOMP)
1. Pure websocket:
* Advantages:
* direct use WebSocket object in JavaScript
* no additional overhead
* Disadvantages:
* sometime could not work (e.g. [CloudFlare](https://support.cloudflare.com/hc/en-us/articles/200169466))
1. Sock.JS+STOMP
* Advantages:
* work even browser does not support WebSocket or connection to WebSocket server is blocked
* supported by Spring
* Disadvantages:
* add overhead with STOMP protocol
* require additional library for interact with server### Useful gradle commands
1. Run project from console: `./gradlew bootRun`
1. Build executable jar: `./gradlew build`
1. Build test coverage report: `./gradlew check jacocoTestReport` and open `build/reports/jacoco/test/html/index.html`
1. Run project in WildFly 10.0.0: `./gradlew build cargoRunLocal`
* Sometimes WildFly could not access to temp file on VFS and fail deploy, in this case you need to stop WildFly and run command second time
* Sometimes `cargo` could not stop launched application server, in this case you can try stop server by command `./gradlew cargoStopLocal` or kill `java` manual