Giter Site home page Giter Site logo

theonx / ezyfox-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from youngmonkeys/ezyfox-server

0.0 0.0 0.0 3.55 MB

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

License: Apache License 2.0

Shell 0.06% Java 98.91% Groovy 0.07% HTML 0.93% Batchfile 0.04%

ezyfox-server's Introduction

ezyfox-server

Build Status

Documentation

https://tvd12.com/

Synopsis

Ezyfox server is a socket server. It supports both tcp socket and websocket. It also provides manipulation beans, auto binding, auto implementation and more utilities.

Code Example

1. Create an app entry

public class EzyChatEntryLoader extends EzyAbstractAppEntryLoader {

	@Override
	public EzyAppEntry load() throws Exception {
		return new EzyChatEntry();
	}
	
}

2. Create bean context

private EzyBeanContext createBeanContext(
			EzyPluginContext context, EzyApply<EzyBeanContextBuilder> applier) {
    	EzyBindingContext bindingContext = createBindingContext();
    	EzyMarshaller marshaller = bindingContext.newMarshaller();
    	EzyUnmarshaller unmarshaller = bindingContext.newUnmarshaller();
    	EzyBeanContextBuilder beanContextBuilder = EzyBeanContext.builder()
    			.addSingleton("pluginContext", context)
    			.addSingleton("marshaller", marshaller)
    			.addSingleton("unmarshaller", unmarshaller)
    			.scan("vn.team.freechat.plugin")
    			.scan("vn.team.freechat.common.repo")
    			.scan("vn.team.freechat.common.service");
    	
    	applier.apply(beanContextBuilder);

		return beanContextBuilder.build();
}

3. Auto implementation

@EzyAutoImpl
public interface EzyChatMessageRepo 
	extends EzyMongoRepository<ObjectId, EzyChatMessage> {

}

4. Auto binding

@EzyPrototype(properties = { @EzyKeyValue(key = "type", value = "REQUEST_HANDLER"),
		@EzyKeyValue(key = "cmd", value = "2") })
@EzyArrayBinding(indexes = { "message", "receiver" })
@Setter
public class EzyChatUserRequestHandler extends EzyClientRequestHandler implements EzyDataBinding {

	private String message;
	private String receiver;

	@EzyAutoBind
	private EzyChatMessageRepo ezyChatMessageRepo;

	@EzyAutoBind
	private EzyResponseFactory responseFactory;
}

5. Auto serialize

@Getter
@Setter
@EzyObjectBinding(read = false)
public class EzyChatError {

	private final int code;
	private final String message;
	
}

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

ezyfox-server's People

Contributors

tvd12 avatar sonph95 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.