How to define a good message map

Source: Internet
Author: User

The simplest way is to create a global map, and then register it in different places.

The registration step is automatically generated in macro mode. As a stepping stone, what about parameter transmission ???

Do not pass scattered args. Define a specific Arg structure and perform forced conversion in a specific Handel.

All messagehandel interfaces have the same reason, because they all come from the same message entry. Different functions are called, so all interfaces are in the same form.

The upper-layer portal will restrict the lower-layer access.

What is the map key? Msg id.

Processing logic recvdata --> Unpack-> map [msgid] (msgdata)

The relationship between a client and a player is obviously a one-to-one ing between the two. After login, a client and a player (which can be inserted into their respective managers) can be established. The client is mainly used for sending and receiving messages, representing a socket, and the player represents a logical unit.

So how does the client send and receive messages? What is the relationship between client and session? Session has socket.


Connection session client player


How to define a good message map

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.