local MsgPack = MsgPack local skynet = require "skynet" local TIME_WAIT = 10 local _M = class("chat", require("unitTest.unitTest")) function _M:start() self:task() end local taskMap = { chat = {100}, searchFriend = {100}, friendList = {100}, friendRandom = {100}, } function _M:task() local curTask = math.randWeight(taskMap, 1) self[curTask](self) skynet.timeout(TIME_WAIT * 100, handler(self, self.task)) end function _M:chat() requestServer(actionCodes.Role_chatRpc, MsgPack.pack({ cmd = 1, content = "我就是个机器人, 我来测试测试没问题吧。"})) end function _M:searchFriend() requestServer(actionCodes.Friend_searchRpc, MsgPack.pack({ key = "hehehe"})) end function _M:friendList() requestServer(actionCodes.Friend_listRpc, '') end function _M:friendRandom() requestServer(actionCodes.Friend_randomRpc, '') end return _M