A tiny WebSocket server written in Java 8.
Because it's fun and I wanted to be able to have a WebSocket server without several megabytes of dependencies.
Version 0.0.6.
It passes all tests of Autobahn|Testsuite version 0.7.5, except 12.* and 13.* (compression using the permessage-deflate extension).
Features:
- Standards-compliant (according to AutoBahn|Testsuite at least)
- Tiny—one file
- NO external dependencies
- Requires Java 8 (Travis-CI currently runs the tests against 1.8.0_31)
- Multiple endpoints
- Configurable Maximum frame size (controls fragmentation)
- Configurable address and port
- Configurable backlog
- Logging via simple interface—no dependency on any particilar log framework
- SSL (WSS) support
- Fallback handler, for endpoints without a WebSocket handler
Limitations:
- No frame compression support
- No extension support
- Maximum payload size is 0x7fffffff (2147483647) bytes
- Only talks protocol version 13 (mandated by RFC 6455)
./gradlew test
Note that the tests requires wstest to be installed and available on the path.
The echoserver folder contains an—drum roll—echo server!
Create an Autobahn configuration file named fuzzingclient.json, e.g.:
{
"servers": [{ "url": "ws://127.0.0.1:9001" }],
"cases": ["*"],
}
Run the echo server (which starts on port 9001):
./gradlew run
Run wstest:
wstest -m fuzzingclient
For SSL, change fuzzingclient.json so that it uses a wss URL instead:
{
"servers": [{ "url": "wss://127.0.0.1:9001" }],
"cases": ["*"],
}
...and then run the echo server like this:
./gradlew -Pargs="wss/keystore.jks storepassword keypassword" run
(Yes, those are the actual passwords—they're not placeholders.)
TBD
See CHANGELOG.md.
Per Rovegård
Twitter: @provegard
MIT, https://per.mit-license.org/2017
See also the LICENSE file.