Skip to content
Hydra is a network framework built upon Netty
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
all
client
example
server
shared
test
.bettercodehub.yml
.gitignore
.travis.yml
LICENSE
README.md
_config.yml Set theme jekyll-theme-midnight Jul 10, 2018
pom.xml

README.md

hydra banner

Maven Central BCH compliance Build Status Coverage Status License

Description

Hydra is built upon Netty. It is supposed to simplify the process of socket setup in Java. Netty allows high performances and good maintainability of programs built upon it. And here comes Hydra in. Hydra uses the builder-pattern in order to make the process of socket setup even simpler. Hydra comes with a handy packet system that allows you to easily create your own packets and send them via the session Hydra creates for you. Furthermore you have the ability to create packets and listener which just need a simple annotation and will be invoked by Hydra when a packet is received. Convince yourself by taking a look at the client and server examples.

Wiki

In case you would like to have an in-depth introduction to Hydra, please take a look at the wiki. The wiki takes you step-by-step through the setup of a server and a client. Furthermore the wiki features example usages, like a simple chat application and a key-value store.

Quantitative benefits over raw netty

Raw netty code for server setup:

original netty code

Hydra code for server setup:

hydra code

Installing

  • Install Maven 3
  • Clone/Download this repo
  • Install it with: mvn clean install

Maven

Local Maven dependency

<dependency>
    <groupId>de.datasecs</groupId>
    <artifactId>hydra-all</artifactId>
    <version>1.6.2</version>
</dependency>

Maven central

<dependency>
    <groupId>de.datasecs</groupId>
    <artifactId>hydra-all</artifactId>
    <version>1.6.0</version>
</dependency>

If you would like to just have the client or server, use hydra-client or hydra-server instead of hydra-all as artifact id.

And if you don't use maven you can download a release version and include it in your project the way you prefer.

Examples

Client

HydraClient client = new Client.Builder("localhost", 8888, new SampleProtocol())
                .workerThreads(4)
                .option(ChannelOption.TCP_NODELAY, true)
                .build();

This is an easy to understand example of how to create a client socket. In order to make the packet system work, you have to register your created packets and listeners. For detailed information on how to do that and examples see the client example.

Server

HydraServer server = new Server.Builder("localhost", 8888, new SampleProtocol())
                .bossThreads(2)
                .workerThreads(4)
                .option(ChannelOption.TCP_NODELAY, true)
                .build();

This here is an example of how to create a server socket. In order to make the packet system work, you have to register your created packets and listeners. For detailed information on how to do that and examples see the server example.

Javadoc

The javadoc is always up-to-date and can be found on hydra.datasecs.de/javadoc

License

Licensed under the BSD 2-Clause License - see the LICENSE file for details.

Credits

Special thanks go to Aadi Bajpai for creating the awesome banner and logo!

You can’t perform that action at this time.