Framework for creating custom servers
Project description
Welcome! This is framework for creating custom servers. Can be used as foundation for MMO RPG servers, or web servers. Developed and tested on Python 3.6 on Linux.
Installation
You need Python 3.6. To install needed dependencies run next command:
pip3 install -r requirements.txt
Database
Framework contains DB connection builder, that support mysql, postgresql or sqlite. You possible will need to install additional db drivers from dict below:
SUPPORTED_DB_DRIVERS = {
'mysql': (
'mysqlconnector',
'pymysql',
'pyodbc',
),
'postgresql': (
'psycopg2',
'pg8000',
'pygresql',
)
}
Please find how to install additional db drivers (and how to install and configure db) depending on your platform and operation system.
For example, for psycopg2
(Linux Mint) you will need to run next commands:
sudo aptitude install libpq-dev python-dev
pip3 install psycopg2
For pg8000
(Linux Mint) just run:
pip3 install pg8000
Please note! Possible you will need to install extra dependencies for this drivers depends on your platform and operation system.
How to use
import asyncio
from idewavecore import Assembler
from idewavecore.session import Storage
if __name__ == '__main__':
loop = asyncio.get_event_loop()
global_storage = Storage()
assembler = Assembler(
global_storage=global_storage,
config_path='settings.yml'
)
servers = assembler.assemble()
for server in servers:
server.start()
loop.run_until_complete(
asyncio.gather(*[server.get() for server in servers])
)
try:
loop.run_forever()
except KeyboardInterrupt:
pass
finally:
loop.close()
Config
Config is main part of application. You will use it to describe all your servers and db connections.
Please look into settings.yml.dist
for example. You can use any name for config and also you can split config into multiple .yml
files by using !inject <path>
custom tag.
Storages
Framework use three type of storages: global storage, server storage and session storage. All storages are instances of Storage
.
All servers of application connected with global storage. You can modify global storage from any part of your application.
Each server has server storage. Basically it use for broadcast.
Each connection will generate session storage. This type of storage keep client session info.
Middlewares
Each server use middlewares. It is special function that can access all types of storages.
Middlewares can communicate between each other by setting fields inside one of the storages.
Framework contains some predefined middlewares that can be used for common purposes. There middlewares for read, write, broadcast, parse http request, for testing and for encrypt (decrypt) data.
You can implement own middlewares. To use them all you need is create middlewares
dir inside root of your project and use same structure as native middlewares has.
To allow framework to recognize if middleware is native or not you will need to add native.
prefix to the path of native middleware. For custom middleware just use its path.
Gratefulness
I am grateful to all guys who shared their ideas and suggestions, or explained how mmo rpg server works. In particular to Kyoril, sundays and brotalnia. I believe I will extend this list.
Also thanks to MANGOS community for great project and for responsiveness.
Additional
Some approaches for my framework I took from my another project with similar name https://github.com/sergio-ivanuzzo/idewave-core. But they are not same.
Documentation
For now only README, source code and tests. I will update this section when project's wiki will be ready.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file idewavecore-0.0.1.tar.gz
.
File metadata
- Download URL: idewavecore-0.0.1.tar.gz
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 716368df6199910b7eff26ba5af226b8241fdf7906dcbff3e6229cd0aaadd60c |
|
MD5 | eea21d0b51c6c21bb664c2dad2b00b60 |
|
BLAKE2b-256 | cd2d85721d3c11ab9b750088e569c32d4b5ed28c33b4580ce6bf4f0feefe674a |
File details
Details for the file idewavecore-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: idewavecore-0.0.1-py3-none-any.whl
- Upload date:
- Size: 39.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 603dc4a71cfe849b65c606f86a53103c2c56757608d0c30fc8219f43cc5b24df |
|
MD5 | 9d8381068b657b0389ff7fc9960c7633 |
|
BLAKE2b-256 | 8e54d4eb285a6694df890babac8dd757456c1febad0f0eca75fc3d36e8be53fe |