Skip to content

a socket server supports for message and streaming data with tcp, udp and websocket

License

Notifications You must be signed in to change notification settings

wakawa2003/ezyfox-server

 
 

Repository files navigation

ezyfox-server

Build Status

Documentation

https://youngmonkeys.org/ezyfox-sever/

Synopsis

Ezyfox Server is a socket server. It supports TCP, UDP and Websocket protocol. It also provides manipulation beans, auto binding, auto implementation and more utilities.

Dependency

<dependency>
    <groupId>com.tvd12</groupId>
    <artifactId>ezyfox-server-embedded</artifactId>
    <version>1.1.4</version>
</dependency>

Benchmark

Ezyfox Server's benchmark with 1000 CCU broadcast messages in 1 hour on one VPS ram 512MB, CPU 1 core

Code Example

1. Create an app entry

public static class HelloAppEntry extends EzySimpleAppEntry {

    @Override
    protected String[] getScanableBeanPackages() {
        return new String[] {
                "com.tvd12.ezyfoxserver.embedded.test" // replace by your package
        };
    }

    @Override
    protected String[] getScanableBindingPackages() {
        return new String[] {
                "com.tvd12.ezyfoxserver.embedded.test" // replace by your package
        };
    }
    
    @Override
    protected EzyAppRequestController newUserRequestController(EzyBeanContext beanContext) {
        return EzyUserRequestAppSingletonController.builder()
                .beanContext(beanContext)
                .build();
    }
    
}

2. Create a plugin entry

public static class HelloPluginEntry extends EzySimplePluginEntry {

    @Override
    protected String[] getScanableBeanPackages() {
        return new String[] {
                "com.tvd12.ezyfoxserver.embedded.test" // replace by your package
        };
    }

}

3. Setup

EzyPluginSettingBuilder pluginSettingBuilder = new EzyPluginSettingBuilder()
        .name("hello")
        .addListenEvent(EzyEventType.USER_LOGIN)
        .entryLoader(HelloPluginEntryLoader.class);

EzyAppSettingBuilder appSettingBuilder = new EzyAppSettingBuilder()
        .name("hello")
        .entryLoader(HelloAppEntryLoader.class);

EzyZoneSettingBuilder zoneSettingBuilder = new EzyZoneSettingBuilder()
        .name("hello")
        .application(appSettingBuilder.build())
        .plugin(pluginSettingBuilder.build());

EzySimpleSettings settings = new EzySettingsBuilder()
        .zone(zoneSettingBuilder.build())
        .build();

4. Create and start a server

EzyEmbeddedServer server = EzyEmbeddedServer.builder()
        .settings(settings)
        .build();
server.start();

You can find full example here

Used by

  1. Space Game
  2. Free Chat

Motivation

We are game server developers, We have a lot of online games and We must buy game server engine like SmarfoxServer or Photon but they are really expensive. We need make a change to help us and everyone. Free is good idea and We make Ezyfox server

API Reference

Tests

mvn test

Contributors

License

  • Apache License, Version 2.0

About

a socket server supports for message and streaming data with tcp, udp and websocket

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 98.9%
  • Other 1.1%