[go: up one dir, main page]

CN118573646A - Instant communication method without center server - Google Patents

Instant communication method without center server Download PDF

Info

Publication number
CN118573646A
CN118573646A CN202410722137.1A CN202410722137A CN118573646A CN 118573646 A CN118573646 A CN 118573646A CN 202410722137 A CN202410722137 A CN 202410722137A CN 118573646 A CN118573646 A CN 118573646A
Authority
CN
China
Prior art keywords
user
client
message
group
terminal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410722137.1A
Other languages
Chinese (zh)
Inventor
孔祥博
黄宇
倪星光
杨志峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongke Shitong Hengqi Beijing Technology Co ltd
Original Assignee
Zhongke Shitong Hengqi Beijing Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhongke Shitong Hengqi Beijing Technology Co ltd filed Critical Zhongke Shitong Hengqi Beijing Technology Co ltd
Priority to CN202410722137.1A priority Critical patent/CN118573646A/en
Publication of CN118573646A publication Critical patent/CN118573646A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/02Details
    • H04L12/16Arrangements for providing special services to substations
    • H04L12/18Arrangements for providing special services to substations for broadcast or conference, e.g. multicast
    • H04L12/1813Arrangements for providing special services to substations for broadcast or conference, e.g. multicast for computer conferences, e.g. chat rooms

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • General Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本发明公开了一种无中心服务器的即时通讯方法。本发明通过在客户端本地注册用户和在局域网环境下发现用户的方式,实现了无中心服务器下的局域网场景下的终端间的即时通讯。提供了一套创新的在客户端本地注册用户的方法,提高了局域网环境下即时沟通的安全性;提供了一套在局域网环境下发现用户的方法,互相信任的客户端才能发现彼此,才能互相交流。另外,即时通讯产生的数据都保存在客户端本地,无需对数据进行云上维护,运行客户端的终端关机,通讯数据即被清楚,通讯安全性更高。

The present invention discloses an instant messaging method without a central server. The present invention realizes instant messaging between terminals in a local area network scenario without a central server by registering users locally on the client and discovering users in a local area network environment. A set of innovative methods for registering users locally on the client is provided, which improves the security of instant messaging in a local area network environment; a set of methods for discovering users in a local area network environment is provided, so that clients that trust each other can discover each other and communicate with each other. In addition, the data generated by instant messaging is stored locally on the client, and there is no need to maintain the data on the cloud. When the terminal running the client is shut down, the communication data is cleared, and the communication security is higher.

Description

无中心服务器的即时通讯方法Instant messaging method without central server

技术领域Technical Field

本发明涉及即时通讯技术领域,具体涉及一种无中心服务器的即时通讯方法。The present invention relates to the technical field of instant messaging, and in particular to an instant messaging method without a central server.

背景技术Background Art

即时通讯系统已经被广泛应用于电子办公的方方面面,在互联网场景下,有着多种多样的即时通讯方法,可以处理文字、图片、视频等。目前,即时通讯系统需要有服务器的支撑才能完成即时通讯功能,比如需要由服务器完成用户注册、用户信息保存、用户关系保存、用户音视频通话等。即时通讯通常的实现方法为:Instant messaging systems have been widely used in all aspects of electronic office. In the Internet scenario, there are various instant messaging methods that can process text, pictures, videos, etc. At present, instant messaging systems need the support of servers to complete instant messaging functions, such as user registration, user information storage, user relationship storage, user audio and video calls, etc. The common implementation methods of instant messaging are:

建立服务器端和客户端Building the server and client

服务器端,用于提供中心服务器功能,用于保存用户的个人基本信息、用户和用户之间的关系、用户群组关系等数据以及提供相应的通讯服务等。The server side is used to provide central server functions, to store users' basic personal information, relationships between users, user group relationships and other data, and to provide corresponding communication services.

客户端,用于从服务器端通过接口获取用户的基本信息、获取用户的联系人列表、获取群组消息、完成用户音频和视频的通话等。The client is used to obtain the user's basic information, contact list, group messages, and complete audio and video calls from the server through an interface.

将上述应用在互联网场景下的即时通讯系统应用到局域网场景下,通过上述方法搭建的中心服务器难以有效、快速的满足企业用户的即时通讯需求,主要存在以下缺陷:When the instant messaging system used in the Internet scenario is applied to the LAN scenario, the central server built by the above method is difficult to effectively and quickly meet the instant messaging needs of enterprise users, and has the following main defects:

1、一旦中心服务器宕机,将无法使用即时通讯的用户注册、登录、沟通等功能,给企业带来影响;1. Once the central server goes down, the user registration, login, communication and other functions of instant messaging will not be available, which will have an impact on the enterprise;

2、在局域网中搭建中心服务器,对于规避较大的企业,需要大量的服务器器硬件资源和人力资源,维护成本很高;2. Building a central server in the local area network requires a large amount of server hardware resources and human resources for larger enterprises, and the maintenance cost is very high;

3、对于一些保密性要求较高的即时通讯,无法达到阅后即焚的效果,存在数据泄露的风险。3. For some instant messaging services that require high confidentiality, the effect of self-destructing after reading cannot be achieved, and there is a risk of data leakage.

发明内容Summary of the invention

本发明以实现无中心服务下的即时通讯,降低即时通讯系统搭建成本,并提高通讯安全性为目的,提供了一种无中心服务器的即时通讯方法。The present invention aims to realize instant messaging without a central server, reduce the cost of building an instant messaging system, and improve communication security, and provides an instant messaging method without a central server.

为达此目的,本发明采用以下技术方案:To achieve this object, the present invention adopts the following technical solutions:

提供一种无中心服务器的即时通讯方法,步骤包括:Provided is an instant messaging method without a central server, the steps comprising:

S1,在客户端本地注册用户后登录所述客户端;S1, registering a user locally on the client and logging into the client;

S2,在局域网环境下发现用户;S2, discovers users in a LAN environment;

S3,发现用户后,通过第一策略添加好友,和/或通过第二策略创建群组,和/或通过第三策略进行单聊或群聊。S3, after discovering the user, add a friend through the first strategy, and/or create a group through the second strategy, and/or conduct a single chat or a group chat through the third strategy.

作为优选,步骤S1中,在客户端本地注册用户的方法包括步骤:Preferably, in step S1, the method for registering a user locally on the client comprises the steps of:

S11,打开所述客户端后激活注册密码;S11, opening the client and activating the registration password;

S12,加密所激活的注册密码,加密方法具体为:S12, encrypting the activated registration password, the encryption method is as follows:

对所述注册密码加随机数后得到随机密码;Adding a random number to the registration password to obtain a random password;

使用加密算法对所述随机密码进一步加密得到加密后的密文作为对所述注册密码的加密结果。The random password is further encrypted using an encryption algorithm to obtain an encrypted ciphertext as the encryption result of the registration password.

作为优选,步骤S11中,激活注册密码的方法为:用户在所述客户端提供的用户界面的指定区域连续点击指定次数。Preferably, in step S11, the method for activating the registration password is: the user clicks a specified number of times continuously in a specified area of the user interface provided by the client.

作为优选,所述注册密码为所述客户端运行的终端的Mac地址或关联所述Mac地址的用户登录密码。Preferably, the registration password is the Mac address of the terminal on which the client runs or a user login password associated with the Mac address.

作为优选,使用AES加密算法进一步加密所述随机密码。Preferably, the random password is further encrypted using an AES encryption algorithm.

作为优选,所述注册密码为运行所述客户端的终端的Mac地址,对所述Mac地址加随机数得到所述随机密码的方法为:Preferably, the registration password is the Mac address of the terminal running the client, and the method of adding a random number to the Mac address to obtain the random password is:

提取所述Mac地址中的最后两位数的数值;Extract the value of the last two digits in the Mac address;

将提取的所述数值转换为十进制;Convert the extracted value into decimal;

为所述终端分配一个随机数;assigning a random number to the terminal;

将转换的十进制数值与所述随机数拼接,拼接结果作为用户登录在所述终端登录所述客户端的登录密码,并将所述拼接结果作为加随机数的所述随机密码。The converted decimal value is concatenated with the random number, and the concatenated result is used as the login password for the user to log in to the client at the terminal, and the concatenated result is used as the random password plus the random number.

作为优选,步骤S2中,发现用户的方法包括步骤:Preferably, in step S2, the method for discovering a user comprises the steps of:

S21,连接局域网路由器,获取用户所登录的所述客户端所运行的终端的本地IP地址S21, connect to the LAN router and obtain the local IP address of the terminal running on the client logged in by the user

S22,定义用户上线命令和用户上线参数;S22, defining a user online command and user online parameters;

S23,所述终端加入组播,并向组播发送上线消息,所述上线消息的内容包括所述上线命令和所述用户上线参数;S23, the terminal joins the multicast and sends an online message to the multicast, where the content of the online message includes the online command and the user online parameter;

S24,接收其他终端对于所述上线消息的反馈,反馈消息中包含执行反馈的其他终端的终端设备信息和登录该终端的其他用户的用户信息。S24, receiving feedback from other terminals regarding the online message, wherein the feedback message includes terminal device information of the other terminals that perform the feedback and user information of other users who log in to the terminal.

作为优选,发现其他用户后可添加对方为好友,步骤S3中,添加好友的所述第一策略、具体包括步骤:Preferably, after finding other users, the users can be added as friends. In step S3, the first strategy for adding friends specifically includes the following steps:

A1,第一用户打开运行在第一终端的第一客户端中的个人信息页面,获取本人个人信息二维码或表征个人信息的数字编码;A1, a first user opens a personal information page of a first client running on a first terminal, and obtains a personal information QR code or a digital code representing the personal information;

A2,第二用户打开运行在第二终端中的第二客户端的图像扫描或数字编码录入功能,扫取所述第一用户打开的所述本人个人信息二维码或录入所述第一用户的所述数字编码后,所述第二终端生成好友验证信息推送给所述第一终端;A2, the second user opens the image scanning or digital code entry function of the second client running in the second terminal, scans the personal information QR code opened by the first user or enters the digital code of the first user, and the second terminal generates friend verification information and pushes it to the first terminal;

A3,所述第一客户端接收到所述好友验证信息后生成验证界面显示给所述第一用户,所述第一用户在所述验证界面通过或拒绝好友验证,通过验证后,所述第二用户被添加值所述第一用户在所述第一客户端中的好友列表中。A3, after receiving the friend verification information, the first client generates a verification interface and displays it to the first user. The first user passes or rejects the friend verification on the verification interface. After passing the verification, the second user is added to the friend list of the first user in the first client.

作为优选,步骤S3中,创建群组的所述第二策略具体包括步骤:Preferably, in step S3, the second strategy for creating a group specifically includes the steps of:

B1,第一用户点击所登录的第一客户端提供的群组创建按钮后跳转到所述用户的好友列表页面;B1, a first user clicks a group creation button provided by a logged-in first client and jumps to the user's friend list page;

B2,在跳转的所述好友列表页面中选择拟邀请加入群组的好友并点击确认后,所述第一客户端生成邀请消息并群发给被邀请的第二用户所登录的第二客户端;B2, after selecting a friend to be invited to join the group in the friend list page that jumps to the page and clicking to confirm, the first client generates an invitation message and sends it to the second client logged in by the invited second user;

B3,每个所述第二客户端接收到所述邀请消息后生成邀请界面显示给所述第二用户,所述第二用户在所述邀请界面接收或拒绝邀请后,所述第二客户端生成第一反馈消息反馈给所述第一客户端;B3, after receiving the invitation message, each of the second clients generates an invitation interface and displays it to the second user. After the second user accepts or rejects the invitation on the invitation interface, the second client generates a first feedback message and feeds it back to the first client;

B4,所述第一客户端将反馈结果为“通过”的每个所述第二用户加入到所创建的群组中;B4, the first client adds each of the second users whose feedback result is "passed" to the created group;

发现用户后,进行单聊或群聊的所述第三策略包括如下步骤:After the user is found, the third strategy of conducting a single chat or a group chat includes the following steps:

C1,在所述第一客户端提供的群组选择界面中选择拟发送消息的群组;C1, selecting a group to which a message is to be sent in a group selection interface provided by the first client;

C2,在所述第一客户端提供的消息输入界面中输入拟发送的消息内容,包括文本、图片、文件、音频、视频等内容中的任意一种或多种;C2, inputting the content of the message to be sent in the message input interface provided by the first client, including any one or more of text, picture, file, audio, video and the like;

C3,所述第一客户端从本地保存的群聊用户库中获取关联步骤C1选中的群组的群聊用户列表;C3, the first client obtains a group chat user list associated with the group selected in step C1 from a locally stored group chat user database;

C4,所述第一客户端将步骤C2输入的拟发送的消息标记为群聊消息,并赋予所述群聊消息相对应的群聊ID,所述群聊ID为步骤C1选择的所述群组的唯一组ID,并将赋予所述群聊ID后的所述群聊消息保存在本地;C4, the first client marks the message to be sent input in step C2 as a group chat message, and assigns a group chat ID corresponding to the group chat message, where the group chat ID is the unique group ID of the group selected in step C1, and saves the group chat message after being assigned the group chat ID locally;

C5,所述第一用户在所述消息输入界面中点击“消息发送”按钮后,所述第一客户端从本地获取相对应的所述群聊消息,并根据所述群聊消息中携带的所述群聊ID获取所述群组中的所有成员登录的所述第二终端的IP地址,并根据IP地址将所述群聊消息发送给通过相应的所述第二客户端推送给相应的所述第二用户;C5, after the first user clicks the "Send Message" button in the message input interface, the first client obtains the corresponding group chat message from the local computer, obtains the IP addresses of the second terminals logged in by all members of the group according to the group chat ID carried in the group chat message, and sends the group chat message to the corresponding second user through the corresponding second client according to the IP address;

C6,接收到所述群聊消息的每个所述第二客户端获取对应的所述第二用户的消息读取状态,并将接收状态和读取状态反馈给所述第一客户端。C6. Each of the second clients that receives the group chat message obtains the message reading status of the corresponding second user, and feeds back the receiving status and the reading status to the first client.

本发明通过在客户端本地注册用户和在局域网环境下发现用户的方式,实现了无中心服务器下的局域网场景下的终端间的即时通讯。提供了一套创新的在客户端本地注册用户的方法,提高了局域网环境下即时沟通的安全性;提供了一套在局域网环境下发现用户的方法,互相信任的客户端才能发现彼此,才能互相交流。另外,即时通讯产生的数据都保存在客户端本地,无需对数据进行云上维护,运行客户端的终端关机,通讯数据即被清楚,通讯安全性更高。The present invention realizes instant communication between terminals in a local area network scenario without a central server by registering users locally on the client and discovering users in a local area network environment. It provides an innovative method for registering users locally on the client, which improves the security of instant communication in a local area network environment; it provides a method for discovering users in a local area network environment, so that clients that trust each other can discover each other and communicate with each other. In addition, the data generated by instant communication is stored locally on the client, and there is no need to maintain the data on the cloud. When the terminal running the client is shut down, the communication data is cleared, and the communication security is higher.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本发明实施例的技术方案,下面将对本发明实施例中所需要使用的附图作简单地介绍。显而易见地,下面所描述的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

图1是本发明实施例提供的无中心服务器的即时通讯方法的实现步骤图;1 is a diagram showing the steps of implementing an instant messaging method without a central server according to an embodiment of the present invention;

图2是本实施例提供的无中心服务器的即时通讯系统的整体架构图;FIG2 is a diagram showing the overall architecture of an instant messaging system without a central server provided in this embodiment;

图3是第一客户端和第二客户端之间进行单聊或群聊的消息发送架构图。FIG3 is a diagram of a message sending architecture for a single chat or a group chat between a first client and a second client.

具体实施方式DETAILED DESCRIPTION

下面结合附图并通过具体实施方式来进一步说明本发明的技术方案。The technical solution of the present invention is further described below with reference to the accompanying drawings and through specific implementation methods.

其中,附图仅用于示例性说明,表示的仅是示意图,而非实物图,不能理解为对本专利的限制;为了更好地说明本发明的实施例,附图某些部件会有省略、放大或缩小,并不代表实际产品的尺寸;对本领域技术人员来说,附图中某些公知结构及其说明可能省略是可以理解的。Among them, the drawings are only used for illustrative explanations, and they only represent schematic diagrams rather than actual pictures, and should not be understood as limitations on this patent; in order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product; for those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.

本发明实施例的附图中相同或相似的标号对应相同或相似的部件;在本发明的描述中,需要理解的是,若出现术语“上”、“下”、“左”、“右”、“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此附图中描述位置关系的用语仅用于示例性说明,不能理解为对本专利的限制,对于本领域的普通技术人员而言,可以根据具体情况理解上述术语的具体含义。The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "inner", "outer", etc. appear, the orientation or position relationship indicated is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as a limitation on this patent. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.

在本发明的描述中,除非另有明确的规定和限定,若出现术语“连接”等指示部件之间的连接关系,该术语应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或成一体;可以是机械连接,也可以是电连接;可以是直接相连,也可以通过中间媒介间接相连,可以是两个部件内部的连通或两个部件的相互作用关系。对于本领域的普通技术人员而言,可以具体情况理解上述术语在本发明中的具体含义。In the description of the present invention, unless otherwise clearly specified and limited, if the term "connection" or the like appears to indicate the connection relationship between components, the term should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two components or the interaction relationship between two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

图2示出了本实施例中构建的无中心服务器的即时通讯系统的整体架构图。本发明实施例提供的无中心服务器的即时通讯方法,具体包括如下步骤:Figure 2 shows the overall architecture of the instant messaging system without a central server constructed in this embodiment. The instant messaging method without a central server provided in this embodiment of the present invention specifically includes the following steps:

S1,在客户端本地注册用户后登录所述客户端;S1, registering a user locally on the client and logging into the client;

客户端包括智能手机、PC台式电脑、笔记本电脑等智能终端。各客户端统一连接到如图2中所示的内网路由器,通过内网LAN通讯。路由器可以是同网段路由器,也可以是多网段路由器。Clients include smart phones, PC desktops, laptops and other intelligent terminals. Each client is uniformly connected to the intranet router shown in Figure 2 and communicates through the intranet LAN. The router can be a router in the same network segment or a router in multiple network segments.

在客户端本地注册用户的方法具体为:The specific method for registering a user locally on the client is:

(1)打开客户端;(1) Open the client;

(2)在客户端提供用户界面的指定区域点击指定次数,以激活注册密码,注册密码为关联客户端所运行的终端的Mac地址的用户登录密码;(2) Click a specified number of times in a specified area of the user interface provided by the client to activate the registration password, which is the user login password associated with the Mac address of the terminal on which the client is running;

(3)加密所激活的注册密码,加密方法为:对注册密码加随机数,计算得到随机密码,然后使用加密算法对随机密码进一步加密得到加密后的密文。加密后的密文也可以展示在用户界面的指定位置。例如,Mac地址为C0-18-03-7A-39-B0,将该Mac地址的最后两位B0,按16进制转换为十进制的“176”,分配一个随机数给该注册密码,比如分配的随机数为“547”,然后将176和547进行拼接,比如拼接为“176547”作为登录密码,最后使用AES算法等加密算法对“176547”做进一步加密后得到密文,比如为“U2FsdGVkX1/AyF0KJ2DR47/ESa946z3xvxRBZDdpMfU=”。(3) Encrypting the activated registration password, the encryption method is: adding a random number to the registration password, calculating a random password, and then using an encryption algorithm to further encrypt the random password to obtain an encrypted ciphertext. The encrypted ciphertext can also be displayed in a specified position on the user interface. For example, the Mac address is C0-18-03-7A-39-B0, the last two digits B0 of the Mac address are converted to decimal "176" in hexadecimal, and a random number is assigned to the registration password, such as the assigned random number is "547", and then 176 and 547 are spliced, such as "176547" as the login password, and finally "176547" is further encrypted using an encryption algorithm such as the AES algorithm to obtain a ciphertext, such as "U2FsdGVkX1/AyF0KJ2DR47/ESa946z3xvxRBZDdpMfU=".

用户在该终端登录该客户端时,解密工具对上述密文进行解密,并记录解密后的登录密码。当用户输入登录密码时,客户端将用户输入的第一登录密码与解密后记录的第二登录密码进行校验,检验成功,则允许登录,否则,提示登录失败。When the user logs in to the client at the terminal, the decryption tool decrypts the ciphertext and records the decrypted login password. When the user enters the login password, the client verifies the first login password entered by the user with the decrypted second login password. If the verification is successful, the login is allowed, otherwise, the login failure is prompted.

S2,在局域网环境下,基于广播和/或组播方法发现用户,具体发现方法包括如下步骤:S2, in a local area network environment, discovering users based on a broadcast and/or multicast method, the specific discovery method includes the following steps:

S21,连接局域网路由器,获取用户所登录的客户端所运行的终端的本地IP地址;每一个连接到路由器的终端设备都会由路由器给分配一个IP地址;S21, connect to the LAN router and obtain the local IP address of the terminal running on the client logged in by the user; each terminal device connected to the router will be assigned an IP address by the router;

S22,定义用户上线命令和用户上线参数,定义的上线命令和上线参数的内容比如为:S22, define a user online command and user online parameters, where the online command and online parameters are defined as follows:

上线命令:msg_br_entry;Online command: msg_br_entry;

昵称参数:msg_nickname;Nickname parameter: msg_nickname;

IP地址:msg_ipaddress;IP address: msg_ipaddress;

端口:msg_port;Port: msg_port;

S23,终端加入组播,并向组播发送上线消息;S23, the terminal joins the multicast and sends an online message to the multicast;

上线消息的内容为步骤S22定义的上线命令和用户上线参数,例如:The content of the online message is the online command and user online parameters defined in step S22, for example:

{{

"operate_type":"msg_br_entry","operate_type":"msg_br_entry",

"msg_nickname":"liming","msg_nickname":"liming",

"msg_ipaddress":"192.168.1.4","msg_ipaddress":"192.168.1.4",

"msg_port":"5000""msg_port":"5000"

}}

上述代码表达组播内容为:用户liming上线了,他的IP地址是192.168.1.4,端口号是5000;The above code expresses the multicast content as follows: user liming is online, his IP address is 192.168.1.4, and the port number is 5000;

S24,接收其他用户对于上线消息的反馈,反馈消息中包含执行反馈的其他终端的终端设备信息和登录该终端的其他用户的用户信息;S24, receiving feedback from other users on the online message, where the feedback message includes terminal device information of other terminals that perform the feedback and user information of other users who log in to the terminal;

其他终端设备接收到liming的上线消息后,将对该上线消息进行自动反馈,反馈消息中包括相应用户的基本信息包括该相应用户登录的终端设备在局域网中的IP地址、文本消息传输端口、文件消息传输端口、音视频流传输端口、用户名等。After other terminal devices receive liming's online message, they will automatically feedback the online message. The feedback message includes the basic information of the corresponding user, including the IP address of the terminal device where the corresponding user logs in in the local area network, text message transmission port, file message transmission port, audio and video stream transmission port, user name, etc.

反馈方式具体为:The specific feedback methods are:

即时通讯系统通过双方的IP地址、端口信息,通过socket发送点对点命令,命令内容比如为:The instant messaging system sends point-to-point commands through the socket using the IP addresses and port information of both parties. The command content is, for example:

{{

"operate_type":"msg_br_entry_response","operate_type":"msg_br_entry_response",

"msg_nickname":"zhangsan","msg_nickname":"zhangsan",

"msg_ipaddress":"192.168.1.5","msg_ipaddress":"192.168.1.5",

"msg_port":"5000""msg_port":"5000"

}}

上述命令表达的意思是:用户zhangsan收到了liming的上线消息,并将zhangsan的基本信息反馈给liming。此后,liming可以使用反馈回来的消息,更新自己的好友列表。The above command means that user zhangsan receives the online message of liming and feeds back zhangsan's basic information to liming. After that, liming can use the feedback message to update his friend list.

为了增加添加好友的安全性,本实施例提供的即时通讯系统还增加了好友验证环节,只有经过彼此认证才能够互相添加为好友。好友验证流程具体包括步骤:In order to increase the security of adding friends, the instant messaging system provided in this embodiment also adds a friend verification process. Only after mutual authentication can they add each other as friends. The friend verification process specifically includes the following steps:

A1,第一用户打开运行在第一终端的第一客户端中的个人信息页面,获取本人个人信息二维码或表征个人信息的数字编码;A1, a first user opens a personal information page of a first client running on a first terminal, and obtains a personal information QR code or a digital code representing the personal information;

A2,第二用户打开运行在第二终端中的第二客户端的图像扫描或数字编码录入功能,扫取第一用户打开的本人个人信息二维码或录入第一用户的数字编码后,第二终端生成好友验证信息推送给第一终端;推送方法为:即时通讯系统根据双方的IP地址、相应的端口,通过socket发送点对点命令;A2, the second user opens the image scanning or digital code entry function of the second client running in the second terminal, scans the personal information QR code opened by the first user or enters the digital code of the first user, and the second terminal generates friend verification information and pushes it to the first terminal; the push method is: the instant messaging system sends a point-to-point command through the socket according to the IP addresses and corresponding ports of both parties;

A3,第一客户端接收到好友验证信息后生成验证界面显示给第一用户,第一用户在验证界面通过或拒绝好友验证,通过验证后,第二用户被添加值第一用户在第一客户端中的好友列表中。A3, after receiving the friend verification information, the first client generates a verification interface and displays it to the first user. The first user passes or rejects the friend verification on the verification interface. After passing the verification, the second user is added to the first user's friend list in the first client.

发现用户并添加还有后转入步骤:Find the user and add them and then transfer them to the following steps:

S3,发现用户后,通过第一策略添加好友,和/或通过第二策略创建群组,和/或通过第三策略进行单聊或群聊,和/或通过第四策略进行音视频通话,和/或通过第五策略进行文件收发。S3, after discovering the user, add friends through the first strategy, and/or create a group through the second strategy, and/or conduct a single chat or group chat through the third strategy, and/or conduct an audio or video call through the fourth strategy, and/or send and receive files through the fifth strategy.

添加还有的第一策略为上述的步骤A1-A3,不再赘述。The first strategy to be added is the above steps A1-A3, which will not be described in detail.

发现用户后,创建群组的第二策略具体包括如下步骤:After the user is found, the second strategy for creating a group includes the following steps:

B1,第一用户点击所登录的第一客户端提供的群组创建按钮后跳转到用户的好友列表页面;B1, the first user clicks a group creation button provided by the first client that has logged in and jumps to the user's friend list page;

B2,在跳转的好友列表页面中选择拟邀请加入群组的好友并点击确认后,第一客户端生成邀请消息并群发给被邀请的第二用户所登录的第二客户端;即时通讯系统通过分别运行第一客户端和第二客户端的第一终端和第二终端的IP地址、端口信息,通过socket以点对点的方式将邀请消息发送群发给被选中的第二用户;B2, after selecting the friend to be invited to join the group in the friend list page that jumps to the page and clicking to confirm, the first client generates an invitation message and sends it to the second client logged in by the invited second user; the instant messaging system sends the invitation message to the selected second user in a point-to-point manner through the socket by using the IP addresses and port information of the first terminal and the second terminal that respectively run the first client and the second client;

B3,每个第二客户端接收到邀请消息后生成邀请界面显示给第二用户,第二用户在邀请界面接收或拒绝邀请后,第二客户端生成第一反馈消息反馈给第一客户端,反馈路径为步骤B2确定的邀请消息发送路径的逆向路径;B3, after receiving the invitation message, each second client generates an invitation interface and displays it to the second user. After the second user accepts or rejects the invitation on the invitation interface, the second client generates a first feedback message and feeds it back to the first client. The feedback path is the reverse path of the invitation message sending path determined in step B2;

B4,第一客户端将反馈结果为“通过”的每个第二用户加入到所创建的群组中。B4, the first client adds each second user whose feedback result is "passed" to the created group.

发现用户后,进行群聊的第三策略具体包括如下步骤:After the user is found, the third strategy for group chat specifically includes the following steps:

C1,在第一客户端提供的群组选择界面中选择拟发送消息的群组;C1, selecting a group to which a message is to be sent in a group selection interface provided by the first client;

C2,在第一客户端提供的消息输入界面中输入拟发送的消息内容,包括文本、图片、文件、音频、视频等内容中的任意一种或多种;C2, inputting the content of the message to be sent in the message input interface provided by the first client, including any one or more of text, picture, file, audio, video and the like;

C3,第一客户端从本地保存的群聊用户库中获取关联步骤C1选中的群组的群聊用户列表;C3, the first client obtains a group chat user list associated with the group selected in step C1 from a locally stored group chat user database;

C4,第一客户端将步骤C2输入的拟发送的消息标记为群聊消息,并赋予群聊消息相对应的群聊ID,群聊ID为步骤C1选择的群组的唯一组ID,并将赋予群聊ID后的群聊消息保存在本地;C4, the first client marks the message to be sent input in step C2 as a group chat message, and assigns a group chat ID corresponding to the group chat message, where the group chat ID is the unique group ID of the group selected in step C1, and saves the group chat message after the group chat ID is assigned locally;

C5,第一用户在消息输入界面中点击“消息发送”按钮后,第一客户端从本地获取相对应的群聊消息,并根据群聊消息中携带的群聊ID获取群组中的所有成员登录的第二终端的IP地址,并根据IP地址将群聊消息发送给通过相应的第二客户端推送给相应的第二用户;C5, after the first user clicks the "Send Message" button in the message input interface, the first client obtains the corresponding group chat message from the local computer, obtains the IP addresses of the second terminals where all members in the group log in according to the group chat ID carried in the group chat message, and sends the group chat message to the corresponding second user through the corresponding second client according to the IP address;

C6,接收到群聊消息的每个第二客户端获取对应的第二用户的消息读取状态,并将接收状态和读取状态反馈给第一客户端。C6. Each second client that receives the group chat message obtains the message reading status of the corresponding second user, and feeds back the receiving status and the reading status to the first client.

单聊和群聊的区别在于,在步骤C1中不需要选择拟发送消息的群组,而是从第一客户端提供的好友列表中选择单个用户,具体的消息发送方法与步骤C1-C6记载的群聊方法原理相同,因此不再赘述。The difference between single chat and group chat is that in step C1, there is no need to select a group to which a message is to be sent, but a single user is selected from the friend list provided by the first client. The specific message sending method is the same as the group chat method described in steps C1-C6, so it will not be repeated here.

第一客户端和第二客户端之间发送单聊或群聊消息的架构图请参照图2。Please refer to FIG2 for an architecture diagram of sending a single chat or group chat message between a first client and a second client.

单聊或群聊消息的发送架构包括:The architecture for sending single or group chat messages includes:

存储层,主要用于存储密码(如注册密码等)、消息、文件、音视频等数据的存储;The storage layer is mainly used to store passwords (such as registration passwords), messages, files, audio and video data;

网络层,主要为各种通讯功能提供网络支撑,比如为无中心服务器条件下的消息发送和接收等功能提供网络支撑;The network layer mainly provides network support for various communication functions, such as message sending and receiving without a central server.

信令层,主要提供业务支撑功能,包括发现用户的命令、各种消息状态的维护等;The signaling layer mainly provides business support functions, including discovering user commands and maintaining various message statuses;

功能层,在存储层、网络层、信令层的技术支撑的技术上,提供各类即时通讯的功能,包括单聊、群聊、消息收发、激活注册密码等功能。The functional layer, based on the technical support of the storage layer, network layer, and signaling layer, provides various instant messaging functions, including single chat, group chat, message sending and receiving, activation of registration passwords, etc.

综上,本发明通过在客户端本地注册用户和在局域网环境下发现用户的方式,实现了无中心服务器下的局域网场景下的终端间的即时通讯。提供了一套创新的在客户端本地注册用户的方法,提高了局域网环境下即时沟通的安全性;提供了一套在局域网环境下发现用户的方法,互相信任的客户端才能发现彼此,才能互相交流。另外,即时通讯产生的数据都保存在客户端本地,无需对数据进行云上维护,运行客户端的终端关机,通讯数据即被清楚,通讯安全性更高。In summary, the present invention realizes instant communication between terminals in a local area network scenario without a central server by registering users locally on the client and discovering users in a local area network environment. It provides an innovative method for registering users locally on the client, which improves the security of instant communication in a local area network environment; it provides a method for discovering users in a local area network environment, so that clients that trust each other can discover each other and communicate with each other. In addition, the data generated by instant messaging is stored locally on the client, and there is no need to maintain the data on the cloud. When the terminal running the client is shut down, the communication data is cleared, and the communication security is higher.

需要声明的是,上述具体实施方式仅仅为本发明的较佳实施例及所运用技术原理。本领域技术人员应该明白,还可以对本发明做各种修改、等同替换、变化等等。但是,这些变换只要未背离本发明的精神,都应在本发明的保护范围之内。另外,本申请说明书和权利要求书所使用的一些术语并不是限制,仅仅是为了便于描述。It should be noted that the above specific implementations are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art should understand that various modifications, equivalent substitutions, changes, etc. can be made to the present invention. However, as long as these changes do not deviate from the spirit of the present invention, they should be within the scope of protection of the present invention. In addition, some terms used in the specification and claims of this application are not restrictive, but are only for the convenience of description.

Claims (9)

1.一种无中心服务器的即时通讯方法,其特征在于,步骤包括:1. A method for instant messaging without a central server, characterized in that the steps include: S1,在客户端本地注册用户后登录所述客户端;S1, registering a user locally on the client and logging into the client; S2,在局域网环境下发现用户;S2, discovers users in a LAN environment; S3,发现用户后,通过第一策略添加好友,和/或通过第二策略创建群组,和/或通过第三策略进行单聊或群聊。S3, after discovering the user, add a friend through the first strategy, and/or create a group through the second strategy, and/or conduct a single chat or a group chat through the third strategy. 2.根据权利要求1所述的无中心服务器的即时通讯方法,其特征在于,步骤S1中,在客户端本地注册用户的方法包括步骤:2. The instant messaging method without a central server according to claim 1 is characterized in that in step S1, the method of registering a user locally on the client comprises the steps of: S11,打开所述客户端后激活注册密码;S11, opening the client and activating the registration password; S12,加密所激活的注册密码,加密方法具体为:S12, encrypting the activated registration password, the encryption method is as follows: 对所述注册密码加随机数后得到随机密码;Adding a random number to the registration password to obtain a random password; 使用加密算法对所述随机密码进一步加密得到加密后的密文作为对所述注册密码的加密结果。The random password is further encrypted using an encryption algorithm to obtain an encrypted ciphertext as the encryption result of the registration password. 3.根据权利要求2所述的无中心服务器的即时通讯方法,其特征在于,步骤S11中,激活注册密码的方法为:用户在所述客户端提供的用户界面的指定区域连续点击指定次数。3. The instant messaging method without a central server according to claim 2 is characterized in that, in step S11, the method for activating the registration password is: the user clicks continuously for a specified number of times in a specified area of the user interface provided by the client. 4.根据权利要求2所述的无中心服务器的即时通讯方法,其特征在于,所述注册密码为所述客户端运行的终端的Mac地址或关联所述Mac地址的用户登录密码。4. The instant messaging method without a central server according to claim 2 is characterized in that the registration password is the Mac address of the terminal on which the client runs or the user login password associated with the Mac address. 5.根据权利要求2所述的无中心服务器的即时通讯方法,其特征在于,使用AES加密算法进一步加密所述随机密码。5. The instant messaging method without a central server according to claim 2 is characterized in that the random password is further encrypted using an AES encryption algorithm. 6.根据权利要求2所述的无中心服务器的即时通讯方法,其特征在于,所述注册密码为运行所述客户端的终端的Mac地址,对所述Mac地址加随机数得到所述随机密码的方法为:6. The instant messaging method without a central server according to claim 2, characterized in that the registration password is the Mac address of the terminal running the client, and the method of adding a random number to the Mac address to obtain the random password is: 提取所述Mac地址中的最后两位数的数值;Extract the value of the last two digits in the Mac address; 将提取的所述数值转换为十进制;Convert the extracted value into decimal; 为所述终端分配一个随机数;assigning a random number to the terminal; 将转换的十进制数值与所述随机数拼接,拼接结果作为用户登录在所述终端登录所述客户端的登录密码,并将所述拼接结果作为加随机数的所述随机密码。The converted decimal value is concatenated with the random number, and the concatenated result is used as the login password for the user to log in to the client at the terminal, and the concatenated result is used as the random password plus the random number. 7.根据权利要求1所述的无中心服务器的即时通讯方法,其特征在于,步骤S2中,发现用户的方法包括步骤:7. The instant messaging method without a central server according to claim 1, characterized in that in step S2, the method for discovering a user comprises the steps of: S21,连接局域网路由器,获取用户所登录的所述客户端所运行的终端的本地IP地址S21, connect to the LAN router and obtain the local IP address of the terminal running on the client logged in by the user S22,定义用户上线命令和用户上线参数;S22, defining a user online command and user online parameters; S23,所述终端加入组播,并向组播发送上线消息,所述上线消息的内容包括所述上线命令和所述用户上线参数;S23, the terminal joins the multicast and sends an online message to the multicast, where the content of the online message includes the online command and the user online parameter; S24,接收其他终端对于所述上线消息的反馈,反馈消息中包含执行反馈的其他终端的终端设备信息和登录该终端的其他用户的用户信息。S24, receiving feedback from other terminals regarding the online message, wherein the feedback message includes terminal device information of the other terminals that perform the feedback and user information of other users who log in to the terminal. 8.根据权利要求1-7任意一项所述的无中心服务器的即时通讯方法,其特征在于,发现其他用户后可添加对方为好友,步骤S3中,添加好友的所述第一策略、具体包括步骤:8. The instant messaging method without a central server according to any one of claims 1 to 7, characterized in that after finding other users, the other users can be added as friends, and in step S3, the first strategy for adding friends specifically includes the steps of: A1,第一用户打开运行在第一终端的第一客户端中的个人信息页面,获取本人个人信息二维码或表征个人信息的数字编码;A1, a first user opens a personal information page of a first client running on a first terminal, and obtains a personal information QR code or a digital code representing the personal information; A2,第二用户打开运行在第二终端中的第二客户端的图像扫描或数字编码录入功能,扫取所述第一用户打开的所述本人个人信息二维码或录入所述第一用户的所述数字编码后,所述第二终端生成好友验证信息推送给所述第一终端;A2, the second user opens the image scanning or digital code entry function of the second client running in the second terminal, scans the personal information QR code opened by the first user or enters the digital code of the first user, and the second terminal generates friend verification information and pushes it to the first terminal; A3,所述第一客户端接收到所述好友验证信息后生成验证界面显示给所述第一用户,所述第一用户在所述验证界面通过或拒绝好友验证,通过验证后,所述第二用户被添加值所述第一用户在所述第一客户端中的好友列表中。A3, after receiving the friend verification information, the first client generates a verification interface and displays it to the first user. The first user passes or rejects the friend verification on the verification interface. After passing the verification, the second user is added to the friend list of the first user in the first client. 9.根据权利要求1-7任意一项所述的无中心服务器的即时通讯方法,其特征在于,步骤S3中,创建群组的所述第二策略具体包括步骤:9. The instant messaging method without a central server according to any one of claims 1 to 7, characterized in that in step S3, the second strategy for creating a group specifically comprises the steps of: B1,第一用户点击所登录的第一客户端提供的群组创建按钮后跳转到所述用户的好友列表页面;B1, a first user clicks a group creation button provided by a logged-in first client and jumps to the user's friend list page; B2,在跳转的所述好友列表页面中选择拟邀请加入群组的好友并点击确认后,所述第一客户端生成邀请消息并群发给被邀请的第二用户所登录的第二客户端;B2, after selecting a friend to be invited to join the group in the friend list page that jumps to the page and clicking to confirm, the first client generates an invitation message and sends it to the second client logged in by the invited second user; B3,每个所述第二客户端接收到所述邀请消息后生成邀请界面显示给所述第二用户,所述第二用户在所述邀请界面接收或拒绝邀请后,所述第二客户端生成第一反馈消息反馈给所述第一客户端;B3, after receiving the invitation message, each of the second clients generates an invitation interface and displays it to the second user. After the second user accepts or rejects the invitation on the invitation interface, the second client generates a first feedback message and feeds it back to the first client; B4,所述第一客户端将反馈结果为“通过”的每个所述第二用户加入到所创建的群组中;B4, the first client adds each of the second users whose feedback result is "passed" to the created group; 发现用户后,进行单聊或群聊的所述第三策略包括如下步骤:After the user is found, the third strategy of conducting a single chat or a group chat includes the following steps: C1,在所述第一客户端提供的群组选择界面中选择拟发送消息的群组;C1, selecting a group to which a message is to be sent in a group selection interface provided by the first client; C2,在所述第一客户端提供的消息输入界面中输入拟发送的消息内容,包括文本、图片、文件、音频、视频等内容中的任意一种或多种;C2, inputting the content of the message to be sent in the message input interface provided by the first client, including any one or more of text, picture, file, audio, video and the like; C3,所述第一客户端从本地保存的群聊用户库中获取关联步骤C1选中的群组的群聊用户列表;C3, the first client obtains a group chat user list associated with the group selected in step C1 from a locally stored group chat user database; C4,所述第一客户端将步骤C2输入的拟发送的消息标记为群聊消息,并赋予所述群聊消息相对应的群聊ID,所述群聊ID为步骤C1选择的所述群组的唯一组ID,并将赋予所述群聊ID后的所述群聊消息保存在本地;C4, the first client marks the message to be sent input in step C2 as a group chat message, and assigns a group chat ID corresponding to the group chat message, where the group chat ID is the unique group ID of the group selected in step C1, and saves the group chat message after being assigned the group chat ID locally; C5,所述第一用户在所述消息输入界面中点击“消息发送”按钮后,所述第一客户端从本地获取相对应的所述群聊消息,并根据所述群聊消息中携带的所述群聊ID获取所述群组中的所有成员登录的所述第二终端的IP地址,并根据IP地址将所述群聊消息发送给通过相应的所述第二客户端推送给相应的所述第二用户;C5, after the first user clicks the "Send Message" button in the message input interface, the first client obtains the corresponding group chat message from the local computer, obtains the IP addresses of the second terminals logged in by all members of the group according to the group chat ID carried in the group chat message, and sends the group chat message to the corresponding second user through the corresponding second client according to the IP address; C6,接收到所述群聊消息的每个所述第二客户端获取对应的所述第二用户的消息读取状态,并将接收状态和读取状态反馈给所述第一客户端。C6. Each of the second clients that receives the group chat message obtains the message reading status of the corresponding second user, and feeds back the receiving status and the reading status to the first client.
CN202410722137.1A 2024-06-05 2024-06-05 Instant communication method without center server Pending CN118573646A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410722137.1A CN118573646A (en) 2024-06-05 2024-06-05 Instant communication method without center server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410722137.1A CN118573646A (en) 2024-06-05 2024-06-05 Instant communication method without center server

Publications (1)

Publication Number Publication Date
CN118573646A true CN118573646A (en) 2024-08-30

Family

ID=92465340

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410722137.1A Pending CN118573646A (en) 2024-06-05 2024-06-05 Instant communication method without center server

Country Status (1)

Country Link
CN (1) CN118573646A (en)

Similar Documents

Publication Publication Date Title
US11855795B1 (en) Communication bridging in a remote office environment
US11265325B2 (en) Systems and methods of salutation protocol to communicate using a private overlay peer to peer network
US10454762B2 (en) System and method of processing media traffic for a hub-based system federating disparate unified communications systems
CN100531208C (en) Method and apparatus for performing a secure transaction in a trusted network
US8200819B2 (en) Method and apparatuses for network society associating
CN101361037B (en) System and method for associating private user identities with public user identities
US8621090B2 (en) System and method for providing sequenced anonymous communication sessions over a network
EP1974501B1 (en) Ad-hoc creation of group based on contextual information
US7792924B2 (en) Using a mobile phone to remotely control a computer via an overlay network
US20030105812A1 (en) Hybrid system architecture for secure peer-to-peer-communications
US20140040404A1 (en) System and method for federating chat rooms across disparate unified communications systems
US20070019806A1 (en) System and method for establishing secondary channels
US20070100944A1 (en) Uniform resource identifier decoration to enable connectivity for instant messaging providers serving non-authoritative namespaces
Fong et al. Towards an open protocol for secure online presence notification
Chatterjee et al. Instant messaging and presence technologies for college campuses
CN106257888A (en) Private Cloud Routing Server Connection Mechanism for Private Communication Architecture
WO2015054522A1 (en) Federating chat rooms across disparate unified communications systems
US20060168553A1 (en) Software development kit for real-time communication applications and system
CN118573646A (en) Instant communication method without center server
Lawton Instant messaging puts on a business suit
Barry et al. Instant messaging: Standards, protocols, applications, and research directions
CN118540434A (en) Video conference communication method and system
WO2016179538A1 (en) System and method of processing media traffic for a hub-based system federating disparate unified communications systems
Gasakis et al. The New Era Of Exponential Encryption:-Beyond Cryptographic Routing with the Echo Protocol [Paperback]
Iyanda et al. Enhancement of a Secured Instant Messenger and Message Broadcasting with Voice

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination