Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gox1337/furynet
kryonet clone using Netty and Fury
https://github.com/gox1337/furynet
apache-fury client deserialization fury game-development game-server gamedev multiplayer multiplayer-game-server netty serialization server tcp tcp-client tcp-server
Last synced: 5 days ago
JSON representation
kryonet clone using Netty and Fury
- Host: GitHub
- URL: https://github.com/gox1337/furynet
- Owner: GoX1337
- Created: 2024-05-20T16:17:31.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-05-28T12:07:27.000Z (5 months ago)
- Last Synced: 2024-05-29T02:56:39.103Z (5 months ago)
- Topics: apache-fury, client, deserialization, fury, game-development, game-server, gamedev, multiplayer, multiplayer-game-server, netty, serialization, server, tcp, tcp-client, tcp-server
- Language: Java
- Homepage:
- Size: 26.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# furynet
[kryonet](https://github.com/EsotericSoftware/kryonet) clone but using [Netty](https://github.com/netty/netty) and [Apache Fury](https://github.com/apache/incubator-fury) for serialization/deserialization
## Example
### Protocol
```java
public static final List> PROTOCOL_EXAMPLE = List.of(
ClientConnection.class,
ClientDisconnection.class,
Request.class,
Response.class,
BroadcastMessage.class
);
```### Client
```java
Client client = Client.builder()
.hostname("127.0.0.1")
.tcpPort(42000)
.protocol(Protocol.PROTOCOL_EXAMPLE)
.register(ClientConnection.class, (c, msg) -> logger.info("New player connected"))
.register(ClientDisconnection.class, (c, msg) -> logger.info("A player disconnected"))
.register(Response.class, (c, msg) -> logger.info("Received response msg {}", msg))
.register(BroadcastMessage.class, (c, msg) -> logger.info("Received broadcasted msg {}", msg))
.build();client.start();
client.sendTcp(new Request("Hello there"));
```### Server
```java
Server server = Server.builder()
.tcpPort(42000)
.protocol(Protocol.PROTOCOL_EXAMPLE)
.register(ServerEvent.NEW_CLIENT_CONNECTION, (connection) -> {
connection.sendToAllExceptTcp(new ClientConnection());
})
.register(ServerEvent.CLIENT_DISCONNECTED, (connection) -> {
connection.sendToAllTcp(new ClientDisconnection());
})
.register(Request.class, (connection, msg) -> {
connection.sentTcp(new Response());
})
.register(BroadcastMessage.class, (connection, msg) -> {
connection.sendToAllExceptTcp(msg);
})
.build();server.start();
```