8000 GitHub - toobeeh/Ithil-Rebirth: Node.js based socket.io backend for skribbltypo clients
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on May 17, 2025. It is now read-only.

toobeeh/Ithil-Rebirth

Repository files navigation

Deprecated

Ithil-rebirth is now deprecated and replaced by the SignalR C# server Avallone.

Ithil-Rebirth

part of Typo ecosystem

Ithil-Rebirth is the successor and re-write of toobeeh/Ithil.
This node-js server has the same tasks as its predecessor (see Tasks), while its focus is on improving maintainability, readability and performance boost.

⚡ Features following changes:

  • Written in TypeScript, using types where possible, and thoroughly commented with JSDoc
  • Separated Drop Server to keep the event loop latency minimal and consistent for all drop recipients
  • More asynchronous database execution, results in noticeable performance boost eg. in image cloud
  • More modular code - functions like balancer, IPC connections and sockets all moved to separate module classes

Tasks

The Ithil server is the interface between a typo user on skribbl and all Palantir features. The original PHP pseudo-api was replaced with a more and more advancing socketio server, which is now successed by this nodejs application.

The core functionality is to provide a socketio server which a client on typo connects to.
This socketio server has to process all events - to make clustered operation possible, multiple socketio client servers are coordinated by a main server via IPC.
A connecting client makes a request to a socketio server on the main instance, which responds with the port of the least loaded worker socketio server.

However, since drops are specifically time-critical, there is also a dedicated drop server process, consisting of a bare WebSocket server to dispatch drops.

Functions & Modules

▶️ Entry Points

The Ithil Server consists of different processes / main scripts, as defined in ecosystem.config.js:

  • Main Server:
    Redirects clients to maintain worker load balance, manage drops & typo data; all over an IPC server
  • Worker Server:
    Provides a socket-io for typo connections, managing all their events; connected via IPC to the main server
  • Drop Server:
    Provides a bare WebSocket-Server for as-fast-as-possible drop dispatching; connected via IPC to the main server

🧩 Modules

These servers are using modules to implement their functionality:

  • IPC Server / Socket:
    Contains classes for the IPC Server and IPC Client. These classes are wrapper for the IPC instance and include interfaces, event names and predefined handlers/emitters to enable type-safe communication between main and worker.
  • Socketio Server / Socket & WebSocket Server:
    A module containing all interfaces and eventnames used for the communication between balancer & client socket.io-server as well as the WebSocket server.
    AS well as the IPC communication, event handlers/callbacks are registered and emitters are predefined to keep everything type-safe.
  • Client Balancer:
    The balancer class provides functions to listen to IPC events, enabling a abstracted access to the connected worker's current load balance of connected clients.
    This way, the main server can easily get the least busy worker and send a new client to the worker's port.
  • Data Observer:
    Provides a class that observes the typo data as sprites, lobbies and similar in the database and emits events using IPC to the workers when this data changed.
    This has the benefit that workers don't have to get the data which lowers the worker load.
  • Drops:
    A class that keeps a loop open which continuosly observes drops, handles incoming claims from clients on their workers by the IPC connection and processes them.
    Results are emitted via IPC to the workers.
  • TypoClient:
    The final piece to the client communication from the Ithil Server to a Typo User.
    This class contains user-related functions and a connected socketio-client that listens for all user events and sends responses to them, like image cloud requests and drop claims.

About

Node.js based socket.io backend for skribbltypo clients

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages

0