Coder Social home page Coder Social logo

socketbackendframework's Introduction

Socket Back-End Framework

Architecture

Relay Model

architecture

Request-Response Model

(deprecated)

architecture

Features

  • Each configurable module has a clear responsibility.
  • Business logic decouples from transport infrastructure and pipelines.
  • It both supports the relay network model or the request-response network model.
  • Controllers can have different pipeline domains sent application messages.
  • It supports custom protocols in nature.

How to use

The project SocketBackendFramework.Relay.Sample gives a simple example of using the framework. A new project can take this sample as a boilerplate.

Components

  • TransportAgent := a wrapped socket handler.
  • TransportMapper := an object that organizes many transportAgents.
    • It is only configurable from config.json, not from user code.
  • PacketContext := an object that carries information and flows between a transportMapper and one of its transportAgents.
  • MiddlewareContext := an object that carries information and flows within a pipeline.
    • Users should implement it.
    • Usually, a middlewareContext should bring a packetContext.
  • ContextAdaptor := a convertor between packetContexts and midlewareContexts.
    • It acts as an adaptor between a pipeline and a transportMapper.
      • TransportMappers only accept packetContexts.
      • Pipelines only accept middlewareContexts.
  • Pipeline := a stack-like data structure containing several middlewares.
    • Those middlewares decorate the middlewareContexts that pass through the pipeline.
    • When the middlewareContexts go to the bottom of the pipeline, they should contain information ready to use by controllers.
    • When the middlewareContexts go to the top of the pipeline, each should contain a complete packetContext ready to use by transportAgents.
  • PipelineDomain := a virtual area including a pipeline and a dedicated transportMapper.
  • Workflow := a virtual area that owns a complete and independent back-end server.
    • No data exchange is allowed between workflows.
  • WorkflowPool := a virtual area that collects all the running workflows.
  • Controller := a object that majorly involves business logic.

Notices

  • Disposal of socket handlers
    • When disconnection hits a socket handler, the organizer of many socket handlers should dispose the socket handler.
      • The organizer can be Listener or TransportMapper.
        • Listener disposes TcpSessionHandler.
        • TransportMapper disposes TransportClient.
    • A timeout only directly activates a disconnection, not a disposal.
    • When an organizer decides to dispose one of the socket handlers, it should do the disposal before telling controllers about the disconnection.

socketbackendframework's People

Contributors

banyc avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.