de.datasecs:hydra-server

Hydra is a network framework built upon Netty.

License

License

Categories

Categories

Data
GroupId

GroupId

de.datasecs
ArtifactId

ArtifactId

hydra-server
Last Version

Last Version

1.6.5
Release Date

Release Date

Type

Type

jar
Description

Description

Hydra is a network framework built upon Netty.

Download hydra-server

How to add to project

<!-- https://jarcasting.com/artifacts/de.datasecs/hydra-server/ -->
<dependency>
    <groupId>de.datasecs</groupId>
    <artifactId>hydra-server</artifactId>
    <version>1.6.5</version>
</dependency>
// https://jarcasting.com/artifacts/de.datasecs/hydra-server/
implementation 'de.datasecs:hydra-server:1.6.5'
// https://jarcasting.com/artifacts/de.datasecs/hydra-server/
implementation ("de.datasecs:hydra-server:1.6.5")
'de.datasecs:hydra-server:jar:1.6.5'
<dependency org="de.datasecs" name="hydra-server" rev="1.6.5">
  <artifact name="hydra-server" type="jar" />
</dependency>
@Grapes(
@Grab(group='de.datasecs', module='hydra-server', version='1.6.5')
)
libraryDependencies += "de.datasecs" % "hydra-server" % "1.6.5"
[de.datasecs/hydra-server "1.6.5"]

Dependencies

compile (1)

Group / Artifact Type Version
de.datasecs : hydra-shared jar 1.6.5

Project Modules

There are no modules declared in this project.

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 -U -Dmaven.test.skip=true clean compile install

Maven

Local Maven dependency

<dependency>
    <groupId>de.datasecs</groupId>
    <artifactId>hydra-all</artifactId>
    <version>1.6.5</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!

Versions

Version
1.6.5
1.6.0
1.5.0
1.4.5
1.4.4
1.4.3