diskord icon indicating copy to clipboard operation
diskord copied to clipboard

Multiprocess Sharding(`IPC`) Module

Open VincentRPS opened this issue 4 years ago • 0 comments

Summary

The creation of a ext.ipc module based off the Ext-Creators one

What is the feature request for?

The core library

The Problem

Having to host both the bot and server on the same server

The Ideal Solution

Creating the ipc.Session and ipc.Server processes for creating Sessions which interact with the Server separately

from diskord.ext import ipc, commands

session = ipc.Server(...)

bot = commands.Bot(...)

@session.route(...)
async def get_member_count(data):
    guild = bot.get_guild(data.guild_id)

    return guild.member_count

and a Server process in a different server

from sanic import Sanic
from diskord.ext import ipc

server = Sanic(__name__)
session = ipc.Session(...)

@server.route("/")
async def index():
    req_str = await session.request(...)

    return str(req_str)

The stuff above are mostly based off the discord-ext-ipc examples.

The Current Solution

No response

Additional Context

No response

VincentRPS avatar Jan 01 '22 13:01 VincentRPS