Skip to main content

Websocket based IPC for discord.py bots

Project description

winerp

An IPC based on Websockets. Fast, Stable, and Reliable, perfect for communication between your processes or discord.py bots.

Install using pip install winerp

Working:

This library uses a central server for communication between multiple processes. You can connect a large number of clients for sharing data, and data can be shared between any connected client.

Example Usage:

Server Side:

import winerp

server = winerp.Server(port=8080)
server.start()

Client 1 (some-random-bot):

import discord
from discord.ext.commands import Bot

import winerp

bot = Bot(command_prefix="!", intents=discord.Intents.all())

bot.ipc = winerp.Client(local_name = "some-random-bot", loop = bot.loop, port=8080)

@bot.command()
async def request(ctx):
    # Fetching data from a client named "another-bot" using route "get_some_data"
    data = await bot.ipc.request("get_some_data", source = "another-bot")
    await ctx.send(data)


@bot.ipc.route()
async def get_formatted_data(user_id = None):
    return f"<@{user_id}>"


@bot.ipc.event
async def on_winerp_ready():
    print("Winerp Client is ready for connections")

bot.loop.create_task(bot.ipc.start())
bot.run("TOKEN")

Client 2 (another-bot)

import discord
from discord.ext.commands import Bot

import winerp

bot = Bot(command_prefix="?", intents=discord.Intents.all())

bot.ipc = winerp.Client(local_name = "another-bot", loop = bot.loop, port=8080)

@bot.command()
async def format(ctx):
    # Fetching data from a client named "some-random-bot" using route "get_formatted_data"
    data = await bot.ipc.request("get_formatted_data", source = "some-random-bot", user_id = ctx.author.id)
    await ctx.send(data)


@bot.ipc.route()
async def get_some_data():
    return "You are very cool"


bot.loop.create_task(bot.ipc.start())
bot.run("TOKEN")

Features

  • Fast: Minimum Response Time Recorded: 0.001s
  • Reliable, Stable and Easy to integrate
  • A single hosted server can be used to serve all clients on the machine
  • No limitation on number of connected clients

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

winerp-1.0.6.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

winerp-1.0.6-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file winerp-1.0.6.tar.gz.

File metadata

  • Download URL: winerp-1.0.6.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.5

File hashes

Hashes for winerp-1.0.6.tar.gz
Algorithm Hash digest
SHA256 3ef5587f1a168f9f79f26350da2b00ccf0380847cfd40ee00c48ae35e230cdca
MD5 73a80d4d89ae65826eaea8eadd7ee093
BLAKE2b-256 87927575210dce5f278de4a923836d7655e102314eb7893230f8ec5b02efe49b

See more details on using hashes here.

File details

Details for the file winerp-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: winerp-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.5

File hashes

Hashes for winerp-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6c53173cc05b23809ad8c3f391fe27537890caf415a35c0b1b68e9f70d8c7a82
MD5 208134a4ea663ce57249f3f46ef6d202
BLAKE2b-256 fb1a109707cd5460f93c1a51d066fadf6aa6db7ce84aaaecda6d90d375e50669

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page