Giter Club home page Giter Club logo

asciinem's People

Contributors

hjaremko avatar mdymek avatar

asciinem's Issues

Rework network

Make use of async asio, use websockets and make it "sync, then stream".

Implement network module facade

Network module facade is a simple interface exposing module's services.

Steps:

  • Add interface
  • Implement factory that assembles network facade using asio implementations of the submodules

Suggested interface:

class network {
    virtual auto poll_message() -> types::msg = 0;
    virtual void queue_message(const types::msg&) = 0;
}

Implement server connection manager

Connection manager manages current connected players.
It should poll all connected clients according to the clock and push received data to the message_queue. It should also remove disconnected players from the list.

Done:

  • Interface
  • Connection list
  • Client polling
  • Disconnected players and error handling
  • Broadcasting data to the clients on clock tick

Implement server clock

Implement server clock using Observer pattern.
Clock should run in separate thread notify all subscribers of a new tick id at fixed intervals.

Suggested interfaces:

class clock
{
    virtual void next_tick() /* notify */ = 0;
    virtual void attach(clock_observer) = 0;
    virtual void detach(clock_observer) = 0;
};

next_tick()
{
    for each observer in observers {
        observer->update();
    }
}

class clock_observer
{
    virtual auto update() -> types::tick_id;
   /* update function invokes function that should run on next tick */
};

Implement server network listener

Listener should work in the background and collect new incoming connections. They should be delegated to the connection_manager submodule for further handling.

Steps:

  • Add interface
  • Add asio implementation

Implement database connection bridge

Using Bridge design pattern add database connection interface and implement it using SQLite.
Interface should provide method to execute SQL query (including select queries).

Implement message queue

Should provide basic queue functionality and contain objects of type types::msg.
The queue should be thread safe.

Steps:

  • Add interface
  • Implement interface using std::deque, keep in mind that this queue could be converted into priority queue in the future

Suggested interface:

class message_queue
{
    virtual auto poll() -> types::msg = 0;
    virtual auto push(const types::msg&) = 0;
};

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.