tiennm99andGitHub 97ee581aed @ (#4)
chore: update vulnerable dependencies and add Maven CI

Bump jackson-databind 2.15.2 -> 2.22.1, logback-classic 1.4.8 -> 1.5.38,
slf4j-api 2.0.7 -> 2.0.17, and netty-all 4.1.94 -> 4.1.136 to clear all
open Dependabot security advisories.

Add a GitHub Actions workflow building on JDK 11, and a .gitignore for
Maven/IDE artifacts.
@
2026-07-25 20:53:33 +07:00
2026-07-25 20:53:33 +07:00
2026-07-25 20:53:33 +07:00
2025-02-05 20:47:44 +07:00
2026-07-25 20:53:33 +07:00

Netty WebSocket Game Server

A simple game server implementation using Netty 4 with WebSocket support.

Features

  • WebSocket-based game server using Netty 4
  • JSON message protocol for client-server communication
  • Built-in HTTP server for serving the web client
  • Simple web-based test client

Prerequisites

  • Java 11 or higher
  • Maven 3.6 or higher

Building the Project

mvn clean package

Running the Server

java -cp target/netty-game-server-1.0-SNAPSHOT.jar com.gameserver.GameServer

By default, the server runs on port 8080. You can specify a different port as a command-line argument:

java -cp target/netty-game-server-1.0-SNAPSHOT.jar com.gameserver.GameServer 9000

Testing the Server

  1. Start the server using the instructions above
  2. Open a web browser and navigate to http://localhost:8080
  3. Use the web interface to send test messages to the server

Message Protocol

The server uses a simple JSON-based message protocol:

{
    "type": "MESSAGE_TYPE",
    "payload": "Message content"
}

Supported Message Types

  • PING: Basic ping message
  • Any other type will be echoed back with a SERVER_RESPONSE type

Project Structure

  • GameServer.java: Main server class that initializes Netty
  • GameWebSocketHandler.java: Handles WebSocket frame processing
  • GameMessage.java: Message model for client-server communication
  • HttpStaticFileHandler.java: Serves static web content
  • index.html: Web-based test client
S
Description
Try Solver
Readme Apache-2.0
194 KiB
Languages
Java 81.3%
HTML 18.7%