Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

This is a powerful chat center for all kinds of messages.

Project description

king-chat

This is a powerful chat center for all kinds of messages.

Principles

json in, json out.

That is to say, don't send pure text, it's silly, send json instead.

Installation

sudo pip3 install king-chat

Usage

server

from king_chat import Server

server = Server(ip="127.0.0.1", port=5920)


@server.on_received
def handle(protocol, text):
    print(f"Server got: {text}")
    protocol.send_to_all_except_sender(text)


server.start(wait=True)

client 1

from king_chat import Client

client = Client(name="qq", ip="127.0.0.1", port=5920)


@client.on_received
def on_received(protocol, text):
    print(f"We got a msg: {text}")


client.start(wait=False)

while 1:
    client.send(input('What you wanna say: '))

client 2

from king_chat import Client

client = Client(name="telegram", ip="127.0.0.1", port=5920)


@client.on_received
def on_received(protocol, text):
    print(f"We got a msg: {text}")


client.start(wait=False)

while 1:
    client.send(input('What you wanna say: '))

Project details


Download files

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

Files for king-chat, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size king_chat-0.1.0-py3-none-any.whl (16.7 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size king_chat-0.1.0.tar.gz (15.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page