Message processing method, device, equipment and storage medium

文档序号:1233672 发布日期:2020-09-11 浏览:28次 中文

阅读说明:本技术 消息处理方法、装置、设备和存储介质 (Message processing method, device, equipment and storage medium ) 是由 沈武魁 于 2020-05-29 设计创作,主要内容包括:本发明实施例公开了一种消息处理方法、装置、设备和存储介质。该方法包括:获取由设定游戏服务端生成的待处理的异步消息;若检测到用户离线,则按照预设消息存储结构,封装所述异步消息,生成离线存储消息;将所述离线存储消息存储至数据库,所述离线存储消息用于在所述用户重新登录的情况下发送至所述用户对应的游戏客户端。通过上述技术方案,更加合理地处理游戏中的异步消息,降低了异步消息的丢失率。(The embodiment of the invention discloses a message processing method, a message processing device, message processing equipment and a storage medium. The method comprises the following steps: acquiring asynchronous messages to be processed generated by a set game server; if the user is detected to be offline, the asynchronous message is packaged according to a preset message storage structure, and an offline storage message is generated; and storing the offline storage message to a database, wherein the offline storage message is used for being sent to a game client corresponding to the user under the condition that the user logs in again. By the technical scheme, the asynchronous messages in the game are processed more reasonably, and the loss rate of the asynchronous messages is reduced.)

1. A message processing method, comprising:

acquiring asynchronous messages to be processed generated by a set game server;

if the user is detected to be offline, the asynchronous message is packaged according to a preset message storage structure, and an offline storage message is generated;

and storing the offline storage message to a database, wherein the offline storage message is used for being sent to a game client corresponding to the user under the condition that the user logs in again.

2. The method of claim 1, further comprising, before encapsulating the asynchronous message in accordance with a predetermined message storage structure to generate an offline stored message:

determining whether the asynchronous message is an asynchronous message to be stored or not according to the message type of the asynchronous message and a set message type;

if yes, the step of packaging the asynchronous message according to a preset message storage structure and generating an offline storage message is executed.

3. The method of claim 2, wherein the configuration message types include a level complete handling message type and an item acquisition message type.

4. The method of claim 1, wherein encapsulating the asynchronous message according to a predetermined message storage structure to generate an offline stored message comprises:

analyzing the asynchronous message into a user identifier, a message type and message content according to the preset message storage structure;

and generating serialized data corresponding to the asynchronous message as the offline storage message according to the user identifier, the message type and the message content based on a preset serialization mode.

5. The method of claim 4, further comprising, after storing the offline stored message to a database:

and if the login operation of the user is detected, sending the asynchronous message corresponding to the offline storage message to the game client so that the game client processes the asynchronous message.

6. The method of claim 5, wherein sending the asynchronous message corresponding to the offline stored message to the game client comprises:

inquiring the offline storage message corresponding to the user identification from the database according to the user identification in the login operation;

and converting the offline storage message into the asynchronous message based on the deserialization mode corresponding to the preset serialization mode, and sending the asynchronous message to the game client.

7. The method of claim 6, wherein converting the offline stored message into the asynchronous message based on an deserialization manner corresponding to the preset serialization manner comprises:

and reconstructing the user identifier, the message type and the message content into the asynchronous message according to the message type in the offline storage message based on the deserialization mode.

8. A message processing apparatus, comprising:

the asynchronous message acquisition module is used for acquiring the asynchronous message to be processed generated by the set game server;

the offline storage message generation module is used for packaging the asynchronous message according to a preset message storage structure and generating an offline storage message if the offline of the user is detected;

and the message storage module is used for storing the offline storage message to a database, and the offline storage message is used for sending the offline storage message to the game client corresponding to the user under the condition that the user logs in again.

9. An electronic device, characterized in that the electronic device comprises:

one or more processors;

a storage device for storing one or more programs,

when executed by the one or more processors, cause the one or more processors to implement a message processing method as recited in any of claims 1-7.

10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the message processing method according to any one of claims 1 to 7.

Technical Field

Embodiments of the present invention relate to computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing a message.

Background

In network games, there are asynchronously processed messages between different servers, which need to be returned to the main server and then communicated with the client through the main server so that the client can receive and process the messages.

If the player suddenly drops during the game, the connection between the player and the main server is destroyed at the same time. Thus, when asynchronously processed messages return, they are discarded and not processed normally because the connection between the player and the host server has been interrupted.

The above-mentioned way of handling messages processed asynchronously easily causes the client to lose some important messages, such as clearance settlement messages, etc., which greatly affects the game experience of the player.

Disclosure of Invention

Embodiments of the present invention provide a message processing method, apparatus, device, and storage medium, so as to more reasonably process an asynchronous message in a game, and reduce a loss rate of the asynchronous message.

In a first aspect, an embodiment of the present invention provides a message processing method, including:

acquiring asynchronous messages to be processed generated by a set game server;

if the user is detected to be offline, the asynchronous message is packaged according to a preset message storage structure, and an offline storage message is generated;

and storing the offline storage message to a database, wherein the offline storage message is used for being sent to a game client corresponding to the user under the condition that the user logs in again.

In a second aspect, an embodiment of the present invention further provides a message processing apparatus, where the apparatus includes:

the asynchronous message acquisition module is used for acquiring the asynchronous message to be processed generated by the set game server;

the offline storage message generation module is used for packaging the asynchronous message according to a preset message storage structure and generating an offline storage message if the offline of the user is detected;

and the message storage module is used for storing the offline storage message to a database, and the offline storage message is used for sending the offline storage message to the game client corresponding to the user under the condition that the user logs in again.

In a third aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes:

one or more processors;

a storage device for storing one or more programs,

when the one or more programs are executed by the one or more processors, the one or more processors implement the message processing method provided by any embodiment of the present invention.

In a fourth aspect, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the message processing method provided in any embodiment of the present invention.

The embodiment of the invention obtains the asynchronous message to be processed generated by the set game server; if the user is detected to be offline, the asynchronous message is packaged according to a preset message storage structure, and an offline storage message is generated; and storing the offline storage message to a database, wherein the offline storage message is used for sending the offline storage message to the game client corresponding to the user under the condition that the user logs in again. The method and the system realize that when a user is offline, other game service terminals except the game main service terminal send asynchronous messages to the game main service terminal to be packaged and stored in the database of the main service terminal, so that the user can normally receive and process the asynchronous messages under the condition of logging in again, the problem of important message loss caused by directly discarding the asynchronous messages when the user is offline is solved, the asynchronous messages in the game are processed more reasonably, the loss rate of the asynchronous messages is reduced, and the technical effect of game experience of the user is improved.

Drawings

Fig. 1 is a flowchart of a message processing method according to a first embodiment of the present invention;

fig. 2 is a flowchart of a message processing method according to a second embodiment of the present invention;

fig. 3 is a schematic structural diagram of a message processing apparatus according to a third embodiment of the present invention;

fig. 4 is a schematic structural diagram of an electronic device in a fourth embodiment of the present invention.

Detailed Description

The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.

14页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种多人游戏方法和装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类