Exemple #1
0
        """解散桌子"""
        data = {"user_id": self.user_id}
        await self.send_data(100110, data, ws)

    async def send_100111(self, ws, params={}):
        """解散房间应答"""
        data = {"user_id": self.user_id, "agree": 1}
        await self.send_data(100111, data, ws)

    async def send_100120(self, ws, params={}):
        """玩家自定义配置"""
        data = {"user_id": self.user_id, "custom_config": {}}
        await self.send_data(100120, data, ws)

    async def send_9999(self, ws, params={}):
        pass
        print("stop...")

    async def send_10000(self, ws, params={}):
        data = {"user_id": self.user_id}
        await self.send_data(10000, data, ws)

    def run(self):
        asyncio.get_event_loop().run_until_complete(self.connect_proxy())


if __name__ == "__main__":
    logger.init(module_name="test", log_dir="logs/", level="debug")
    robot = Robot("robot_2.json")
    robot.run()
    # asyncio.get_event_loop().run_until_complete(test_websocket_proxy())
Exemple #2
0
# coding=utf-8
"""
author = jamon
"""

if __name__ == "__main__":
    import sys
    sys.path.append("../")  # 添加项目的根目录到系统路径中

import logging

from obespoir.share.parse_json import ParseJson
from obespoir.server.server import Server
from obespoir.share.ob_log import logger

if __name__ == "__main__":
    main_server = Server()
    # main_server.register_socket_route(WebsocketHandler().websocket_handler)
    serv_config = ParseJson.loads("../service_config.json")

    logger.init(module_name=serv_config.get("name"),
                log_dir=serv_config.get("log_dir", "../logs/"),
                level=serv_config.get("log_level", logging.DEBUG))

    main_server.start(serv_config)