-
Notifications
You must be signed in to change notification settings - Fork 44
FES 转发消息
0xcc edited this page May 9, 2018
·
2 revisions
玩家认证通过后,再接收的消息可以通过配置,自动路由到指定服务器。
服务器根目录的msg.xml
<!--
客户端消息转发 [email protected] 2014
name 消息名字 (key)
sendto 需要转发到的服务器,可填多个 sendto="PLS EGS PDS"
format 转发消息结构 :
UID : 使用userid填充。
JSON :
proto消息 :填写protobuf定义的名字。
基础数据类型:f(float) d(double) b(bool) s(string)
s8 s16 s32 s64 u8 u16 u32 u64
description 消息描述,可用作打印log。
-->
<!-- Common -->
<leaf name="ER" sendto="PLS" format="UID s" description="Enter Room" />
\script\_FES\Msg\MsgLogin.lua
function MsgLogin:CBLoginPLS( pls_id, msg_sdata_2 )
local uid = msg_sdata_2:rint64();
local client = ClientMgr:GetClient(uid);
if( client ~= nil ) then
client.ConPLS = pls_id;
-- 设置UID相关信息,用于底层转发消息。 msg.xml
ClientService:SetClientData( {client.UID, client.SockID, pls_id} );
end
end
\script\_PLS\Msg\MsgRoom.lua
function MsgRoom:Init()
self._EventRegister = EventRegister.new();
self._EventRegister:RegisterEvent( "ER", self, self.CBEnterRoom );
end
function MsgRoom:CBEnterRoom( fes_sid, msg_enter_room )
print("MsgRoom:cbEnterRoom");
end