Code Monkey home page Code Monkey logo

fireio's Introduction

Fire-IO Build Status GitHub version

Fire-IO is a lightning fast yet simple cross platform networking solution that allows you to connect and manage data from multiple platforms with one easy to use java server. The ultimate framework for your networking needs.

And all that for the sweet price of nothing.

Platforms

  • Java Java server
  • Java Client
  • JavaScript Small web client
  • PHP & Other Can make use of socket, websocket or the Rest implementation
  • Load Balancer Fire-IO comes with a real time load balancer to scale your application.
  • Rancher Working within rancher environments with active proxy

Features

  • Events All event driven API
  • Content types Send objects, strings and more with build in (de)serialisation
  • Web Compatible with your web application via our REST service and automatic websocket implementation
  • Data Loss Prevention Automatically detect the failure of a packet and try to repair the data or resend it
  • Auto Reconnect Auto reconnect for all-clients
  • Rate Limiter Build in rate limiter for all your endpoints (rest, api and socket)
  • Async All networking is done in async at all times and events are correctly handled via pools, so no more worrying about response times.
  • Requests Handle requests from clients, assign a response to one specific piece of data
  • Passwords Password protection for your network, don't allow connections without a key
  • Load Balancer improve the reliability and response times of your applications by setting up load balancers to evenly spread the request and connections among your servers.

Useful Links

FireIO depends on:

  • Java 8

Example code

Here is a simple example setup with a server, client, a custom packet, two way data communication and a non blocking data request including a callback

Example Java server

FireIoServer server = new FireIoServer(80)
    .setPassword("testpassword1")
    .setRateLimiter(2, 10)

.on(Event.CONNECT, client -> {
    client.send("MOTD", "test");
})

.on(Event.TIMED_OUT, client -> {
    System.out.println(client.getId() + " closed unexpectedly! " + client.getConnectionType());
})

.on(Event.DISCONNECT, client -> {
    System.out.println(client.getId() + " just disconnected");
})

.onPacket(CookieJar.class, "cookie_jar").onExecute((sender, cookieJar) -> {
    System.out.println("Received a cookie jar from : " + sender.getId() + ". The jar contains " + cookieJar.getAmount() + " cookies. The cookies type is: " + cookieJar.getType());
    //thank the client for the cookies
    sender.send("thanks", "thanks");
});

//simple request based endpoint
server.onRequest("whoami", (client, request, response) -> {
    System.out.println(client.getId().toString() + " asked who it is! sending ip back");
    response.complete(new RequestString("You are: " + client.getInfo().getHostname()));
});

//http time endpoint
server.registerEndpoint("/time", (req, settings) -> {
    return "The server time is: " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
});

//one with a variable, the path is set to /hi/?name
//this will mean that ?name will be a variable, example
server.registerEndpoint("/hi/?name", (req, settings)  -> {
    return "Welcome to FireIO " + req.getVariable("name") + "!";
});

Web JavaScript Client

<script src="Fire-IO.js"></script>
<script>
    const client = new FireIoClient("localhost", 80);
    client.setPassword("testpassword1");
    client.setAutoReconnect(500);
    client.connect();
    
    client.on("connect", function () {
        console.log("connected!!");
        client.send("channel", "Hello world!");
    });
    
    client.on("channel", function (data) {
        console.log("The server said: " + data);
    });
    
    client.on("disconnect", function () {
        console.log("disconnected!!");
    });
</script>

Example Java Client

FireIoClient client = new FireIoClient("localhost", 80)
        .setPassword("testpassword1")
        .setAutoReConnect(2000)
        .setParameter("appversion", "1.0-RELEASE")
        .connect();

.on(Event.CONNECT, ignored -> {
    System.out.println("Connected with the server!");
})

.on(Event.DISCONNECT, ignored -> {
    System.out.println("Connection with the server has closed!");
})

.on("channel", (client, message) -> {
    System.out.println("The message of the day is: " + message);
    //send a cookie jar
    client.send("cookie_jar", new CookieJar(5, "chocolate"));
})

.on("thanks", (client, message) -> {
    System.out.println("The server thanked you for your cookies");
});

Example Custom Java packet (object)

public class CookieJar extends Packet {
    private int amount = 0;
    private String type;
}

fireio's People

Contributors

apocalypsjenl avatar chickenpowerrr avatar duckelekuuk avatar mindgamesnl avatar snowblinderp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

fireio's Issues

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.