WO2023019930A1 - 一种信息同步系统、方法、及设备 - Google Patents

一种信息同步系统、方法、及设备 Download PDF

Info

Publication number
WO2023019930A1
WO2023019930A1 PCT/CN2022/081012 CN2022081012W WO2023019930A1 WO 2023019930 A1 WO2023019930 A1 WO 2023019930A1 CN 2022081012 W CN2022081012 W CN 2022081012W WO 2023019930 A1 WO2023019930 A1 WO 2023019930A1
Authority
WO
WIPO (PCT)
Prior art keywords
room
client
information
request
multimedia
Prior art date
Application number
PCT/CN2022/081012
Other languages
English (en)
French (fr)
Inventor
龚存晨
魏文长
李求会
于猛
杨子闻
张凯
赵忻
Original Assignee
北京达佳互联信息技术有限公司
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 北京达佳互联信息技术有限公司 filed Critical 北京达佳互联信息技术有限公司
Publication of WO2023019930A1 publication Critical patent/WO2023019930A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/21Server components or server architectures
    • H04N21/218Source of audio or video content, e.g. local disk arrays
    • H04N21/2187Live feed
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/242Synchronization processes, e.g. processing of PCR [Program Clock References]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/4302Content synchronisation processes, e.g. decoder synchronisation
    • H04N21/4307Synchronising the rendering of multiple content streams or additional data on devices, e.g. synchronisation of audio on a mobile phone with the video output on the TV screen
    • H04N21/43076Synchronising the rendering of multiple content streams or additional data on devices, e.g. synchronisation of audio on a mobile phone with the video output on the TV screen of the same content streams on multiple devices, e.g. when family members are watching the same movie on different devices

Definitions

  • the present disclosure relates to the field of live video broadcasting, and in particular to an information synchronization system, method and device.
  • a multimedia room there are usually multiple clients online at the same time.
  • the client can turn on the microphone, turn off the microphone or switch roles, and can also leave the multimedia room or close the multimedia room.
  • other clients can apply Join multimedia rooms, and more.
  • the clients in the same multimedia room need to synchronize the status information of the multimedia room to determine the real-time status of other clients in the multimedia room.
  • the client regularly sends an information acquisition request to the server, and pulls and updates the state information of the multimedia room in full from the server.
  • the server may need to provide services for multiple multimedia rooms at the same time, and the number of clients in each multimedia room may also be relatively large. Therefore, the server will receive a large number of information acquisition requests at the same time. Causes a large load pressure, which may lead to problems such as server crashes.
  • the present disclosure provides an information synchronization system, method and device.
  • an information synchronization system includes:
  • the first client is configured to obtain a state change request for the multimedia room, and send the state change request to the service server;
  • the service server is configured to update the first room information of the multimedia room according to the state change request, return the request result of the state change request to the first client, and generate the first room information Incremental message, sending the incremental message to the second client in the multimedia room through a long connection, the first room information is the room information of the multimedia room locally stored by the service server;
  • the first client is further configured to perform an operation corresponding to the state change request in response to receiving the request result;
  • the second client is configured to update the second room information of the multimedia room according to the incremental message, and the second room information is the room information of the multimedia room locally stored by the second client .
  • the service server is configured to determine the version number of the currently generated incremental message according to the version number of the last incremental message, and send the currently generated version number to the second client in the multimedia room through a long connection.
  • the second client is configured to update the second room information according to the received incremental message in response to the version number of the received incremental message being greater than the version number of the second room information, and send the received The version number of the incremental message is used as the version number of the updated second room information.
  • the second client is further configured to send a heartbeat message to the service server at a first time interval
  • the service server is further configured to, in response to not receiving a heartbeat message from any second client within a second time interval, determine that the second client has left the multimedia room, and update the The client list executes the step of generating the incremental message of the first room information.
  • the second client is further configured to detect a long connection with the service server according to a third time interval, and reconnect with the service server in response to detecting that the long connection is disconnected Establish a long connection.
  • the second client is further configured to send a room information acquisition request to the service server at a fourth time interval;
  • the service server is further configured to return the first room information to the second client after receiving the room information acquisition request;
  • the second client is further configured to store the received first room information as new second room information.
  • the second client is further configured to send an incremental message acquisition request, where the incremental message acquisition request carries the version number of the second room information;
  • the service server is further configured to return the incremental message to the second client in response to the version number of any incremental message being greater than the version number carried in the incremental message acquisition request; or, in response to the incremental message None of the version numbers is greater than the version number carried in the incremental message acquisition request, and after the fifth time interval, return an incremental message acquisition result to the second client.
  • the second client is further configured to perform a corresponding operation according to the updated second room information after updating the second room information of the multimedia room.
  • the state change request is a create room request
  • the service server is used to generate basic information of the multimedia room according to the room creation request, request real-time communication service information from the real-time communication server, obtain first room information, and return room creation confirmation information to the first client .
  • the state change request is a request to join a room
  • the first room information further includes a list of clients in the multimedia room
  • the service server is configured to add the first client to the client list according to the room joining request, and return the first room information to the first client;
  • the first client is configured to establish a connection with a real-time communication server according to the real-time communication service information, so that the real-time communication server provides multimedia data collection and streaming services.
  • the state change request is a leave room request
  • the service server is configured to delete the first client from the client list according to the room leaving request, and return room leaving confirmation information to the first client;
  • the first client is configured to send a disconnection request to the real-time communication server in response to receiving the confirmation information for leaving the room, so that the real-time communication server disconnects from the first client.
  • the state change request is a room close request
  • the service server is configured to delete the first client from the client list, and return a confirmation message of leaving the room to the first client;
  • the first client is configured to send a disconnection request to the real-time communication server in response to receiving the confirmation information for leaving the room, so that the real-time communication server disconnects from the first client.
  • the state change request is a role switching request
  • the first room information also includes role information of each client in the multimedia room
  • the service server is configured to update the role information of the first client according to the role switching request, return a request result of the role switching request to the first client, and generate an update of the first room information.
  • An incremental message sending the incremental message to the second client corresponding to the role switching request through a persistent connection.
  • the state change request is a microphone state switch request
  • the first room information also includes microphone state information of each client in the multimedia room:
  • the service server is configured to update the microphone state information of the first client according to the microphone state switching request, and return microphone state switching confirmation information to the first client;
  • the first client is configured to send a real-time communication service request to a real-time communication server in response to receiving the microphone state switching confirmation information, so that the real-time communication server starts or stops collecting and pushing multimedia data.
  • an information synchronization method applied to a first client comprising: acquiring a state change request for a multimedia room, sending the state change request to a service server, Make the service server return the request result of the state change request to the first client, and send an incremental message of the first room information to the second client in the multimedia room through a long connection, and make the
  • the second client updates the second room information according to the incremental message, the first room information is the room information of the multimedia room locally stored by the service server, and the second room information is the second room information of the second client.
  • the room information of the multimedia room stored locally on the terminal; in response to receiving the request result, execute the operation corresponding to the state change request.
  • the service server in response to the state change request being a request to join a room, adds the first client to the client list according to the request to join a room, and adds the first client to the first
  • the client returns the first room information, and the first room information includes a client list and real-time communication service information in the multimedia room;
  • performing an operation corresponding to the state change request includes:
  • the service server in response to the state change request being a request to leave the room, deletes the first client from the client list according to the request to leave the room, and sends the request to the first The client returns a confirmation message for leaving the room;
  • performing an operation corresponding to the state change request includes:
  • a disconnection request is sent to the real-time communication server, so that the real-time communication server disconnects from the first client.
  • the service server in response to the status change request being a room closing request, deletes the first client from the client list, and returns a confirmation message of leaving the room to the first client ;
  • performing an operation corresponding to the state change request includes:
  • a disconnection request is sent to the real-time communication server, so that the real-time communication server disconnects from the first client.
  • the service server in response to the state change request being a microphone state switching request, updates the microphone state information of the first client according to the microphone state switching request, and returns the microphone state information to the first client.
  • State switching confirmation information in response to the state change request being a microphone state switching request, the service server updates the microphone state information of the first client according to the microphone state switching request, and returns the microphone state information to the first client.
  • performing the operation corresponding to the state change request includes:
  • a real-time communication service request is sent to the real-time communication server, so that the real-time communication server starts or stops collecting and pushing multimedia data.
  • an information synchronization method applied to a service server comprising:
  • the state change request update the first room information of the multimedia room, where the first room information is the room information of the multimedia room locally stored by the service server;
  • the generating the incremental message of the first room information and sending the incremental message to the second client in the multimedia room through a persistent connection includes:
  • the method further includes: in response to not receiving a heartbeat message from any of the second clients within a second time interval, determining that the second client has left the multimedia room, updating the first A client list in the room information, execute the step of generating the incremental message of the first room information.
  • the method further includes: after receiving any room information acquisition request sent by the second client, returning the first room information to the second client, so that the second The second client stores the received first room information as new second room information.
  • the method in response to detecting that the long connection between the service server and the second client is disconnected, the method further includes: receiving an incremental message sent by any of the second clients to acquire Request, the incremental message acquisition request carries the version number of the second room information stored by the second client; in response to the version number of any incremental message being greater than the version number carried in the incremental message acquisition request, send the request to the The second client returns the incremental message; or, in response to the fact that the version numbers of the incremental messages are not greater than the version number carried in the incremental message acquisition request, after the fifth time interval, to the second client Return the incremental message to get the result.
  • the method in response to the state change request being a room creation request, the method further includes: the service server generates basic information of a multimedia room according to the room creation request, and requests real-time communication from the real-time communication server service information, obtain the first room information, and return room creation confirmation information to the first client.
  • the first room information in response to the state change request being a request to join a room, the first room information further includes a list of clients in the multimedia room, and the multimedia is updated according to the state change request.
  • the first room information of the room returning the request result of the state change request to the first client, including: adding the first client to the client list according to the request to join the room, and sending the request to the first client.
  • the first client returns the first room information, so that the first client establishes a connection with the real-time communication server according to the real-time communication service information, so that the real-time communication server provides multimedia data collection and pushing streaming service.
  • the first room information of the multimedia room is updated according to the state change request, and the state change is returned to the first client
  • the request result of the request includes: deleting the first client from the client list according to the request to leave the room, and returning confirmation information for leaving the room to the first client, so that the first client
  • the terminal sends a disconnection request to the real-time communication server, so that the real-time communication server disconnects from the first client.
  • the first room information of the multimedia room is updated according to the state change request, and the state change is returned to the first client
  • the request result of the request includes: deleting the first client from the client list, and returning a confirmation message of leaving the room to the first client, so that the first client can report to the real-time communication server Sending a disconnection request, so that the real-time communication server disconnects from the first client.
  • the first room information in response to the state change request being a role switching request, and the first room information further includes role information of each client in the multimedia room,
  • the updating the first room information of the multimedia room according to the state change request, and returning the request result of the state change request to the first client includes: updating the first room information according to the role switching request role information of a client, returning the request result of the role switching request to the first client;
  • the generating the incremental message of the first room information, and sending the incremental message to the second client in the multimedia room through a long connection includes: generating the incremental message of the first room information, through The persistent connection sends the incremental message to the second client corresponding to the role switching request.
  • the first room information in response to the state change request being a microphone state switching request, and the first room information further includes microphone state information of each client in the multimedia room,
  • the updating the first room information of the multimedia room according to the state change request, and returning the request result of the state change request to the first client includes: updating the microphone state switch request according to the Microphone status information of the first client, returning microphone status switching confirmation information to the first client, so that the first client sends a real-time communication service request to the real-time communication server, so that the real-time communication server starts or stops Collection and streaming of multimedia data.
  • an information synchronization method applied to a second client comprising:
  • the first room information is the room information of the multimedia room locally stored by the service server, and the incremental message is the The status change request sent by the first client is generated after updating the first room information of the multimedia room;
  • the incremental message update the second room information of the multimedia room, where the second room information is the room information of the multimedia room locally stored by the second client.
  • the updating the second room information of the multimedia room according to the incremental message includes: in response to the version number of the received incremental message being greater than the version number of the second room information, The second room information is updated according to the received incremental message, and the version number of the received incremental message is used as the updated version number of the second room information.
  • the method further includes: sending a heartbeat message to the service server according to the first time interval, so that in response to the service server not receiving any of the second time intervals within the second time interval heartbeat message from the client, delete the second client from the client list of the first room information, and perform the step of generating the incremental message of the first room information.
  • the method further includes: detecting a long connection with the service server according to a third time interval, and re-establishing with the service server in response to detecting that the long connection is disconnected Long connection.
  • the method further includes: sending a room information acquisition request to the service server according to a fourth time interval, so that the service server returns the first room information;
  • the method in response to detecting that the long connection between the service server and the second client is disconnected, the method further includes: sending an incremental message acquisition request, the incremental message acquisition request carrying The version number of the second room information, so that in response to the version number of any incremental message from the service server being greater than the version number carried in the incremental message acquisition request, the incremental message is returned to the second client message, or in response to the fact that the version number of the incremental message is not greater than the version number carried in the incremental message acquisition request, after a fifth time interval, return an incremental message acquisition result to the second client.
  • the method further includes: performing a corresponding operation according to the updated second room information.
  • an information synchronization device which is applied to a first client, and the device includes:
  • the obtaining unit is configured to obtain a state change request for a multimedia room, and send the state change request to a service server, so that the service server returns a request result of the state change request to the first client, and Send an incremental message of the first room information to the second client in the multimedia room through a long connection, and make the second client update the second room information according to the incremental message,
  • the first room information is the The room information of the multimedia room locally stored by the service server
  • the second room information is the room information of the multimedia room locally stored by the second client;
  • the first receiving unit is configured to execute an operation corresponding to the state change request in response to receiving the request result.
  • an information synchronization device which is applied to a service server, and the device includes:
  • the second receiving unit is configured to receive a state change request for the multimedia room sent by the first client;
  • the first updating unit is configured to update the first room information of the multimedia room according to the state change request, where the first room information is the room information of the multimedia room locally stored by the service server;
  • the sending unit is configured to return the request result of the state change request to the first client, and generate an incremental message of the first room information, and send it to the second client in the multimedia room through a long connection Send the incremental message.
  • an information synchronization device which is applied to a second client, and the device includes:
  • the third receiving unit is configured to receive an incremental message of the first room information sent by the service server through a persistent connection, the first room information is the room information of the multimedia room locally stored by the service server, and the incremental message is The volume message is generated by the service server after updating the first room information of the multimedia room according to the state change request sent by the first client;
  • the second updating unit is configured to update second room information of the multimedia room according to the incremental message, where the second room information is room information of the multimedia room locally stored by the second client.
  • an electronic device including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions, To realize the method described in the second or third aspect.
  • a non-volatile storage medium when the instructions in the non-volatile storage medium are executed by the processor of the electronic device, the electronic device can execute The method described in the second aspect or the third aspect.
  • a computer program product containing instructions, which when run on a computer, causes the computer to implement the method described in the second aspect or the third aspect.
  • the first client obtains a state change request for a multimedia room, and sends the state change request to the service server; the service server updates the first room information of the multimedia room according to the state change request, and sends the request to the second A client returns the request result of the state change request, generates an incremental message of the first room information, and sends an incremental message to the second client in the multimedia room through a long connection.
  • the first room information is the multimedia information stored locally by the service server.
  • the room information of the room, the second client is other clients in the multimedia room except the first client; the first client executes the operation corresponding to the state change request in response to receiving the request result;
  • the volume message updates the second room information of the multimedia room, where the second room information is the room information of the multimedia room locally stored by the second client.
  • the service server after the service server updates the first room information, it can generate and send an incremental message to the second client in the multimedia room, so that the second client can synchronize with the room information of the multimedia room stored in the service server , the second client can reduce the number of information acquisition requests sent to the service server, and also reduce the number of information acquisition requests received by the service server, thereby reducing the load pressure on the service server.
  • Fig. 1A is an interactive schematic diagram of an information synchronization system according to some embodiments of the present disclosure
  • Fig. 1B is a schematic diagram showing a switching logic of roles in a multimedia room according to some embodiments of the present disclosure
  • Fig. 2 is a flow chart showing a method applied to a first client according to some embodiments of the present disclosure
  • Fig. 3 is a flowchart of a method applied to a service server according to some embodiments of the present disclosure
  • Fig. 4 is a flowchart of a method applied to a second client according to some embodiments of the present disclosure
  • Fig. 5 is a block diagram of a device applied to a first client according to some embodiments of the present disclosure
  • Fig. 6 is a block diagram of a device applied to a service server according to some embodiments of the present disclosure
  • Fig. 7 is a block diagram of an apparatus applied to a second client according to some embodiments of the present disclosure.
  • Fig. 8 is a block diagram of a device according to some embodiments of the present disclosure.
  • Fig. 9 is a schematic structural diagram of an electronic device according to some embodiments of the present disclosure.
  • the embodiments of the present disclosure provide an information synchronization system, method, device, device and storage medium.
  • the information synchronization system includes a first client, a service server, and a second client.
  • the service server is the WebServer, which is responsible for maintaining the state of the multimedia room and receiving and distributing all uplink messages, and the first client and the second client are Clients, which can interact with users.
  • the client that sends the state change request is referred to as the first client, and the first client may be a client in the multimedia room, or a client that does not participate in the multimedia room;
  • the client of the incremental message sent by the service server is called the second client, and the second client includes all or some clients in the multimedia room.
  • the first client and the second client may be the same device or different devices, which are not specifically limited.
  • the interaction process between the first client, the service server and the second client may include the following steps: In S101, the first client obtains a state change request for the multimedia room, and sends the state change request to the service Server; in S102, the service server updates the first room information of the multimedia room according to the state change request; in S103, the service server returns the request result of the state change request to the first client; in S104, the first client responds Execute the operation corresponding to the state change request upon receiving the request result; in S105, the service server generates an incremental message of the first room information, and sends the incremental message to the second client in the multimedia room through a long connection; in S106 , the second client updates the second room information of the multimedia room according to the incremental message.
  • the multimedia room may be a video room or a voice room, which is not specifically limited.
  • the state change request may be generated by the first client in response to the user's state change operation through interaction with the user.
  • the state change request may also be obtained by the first client from other user equipment, or Automatically generated according to preset rules.
  • the status change request for the multimedia room may be a request for changing the list of clients in the multimedia room, for example, it may be a request for any client to join the multimedia room (JoinRoom).
  • the change request may be a request for any client to leave the multimedia room (LeaveRoom), and the client may be the first client or another client.
  • the change request may also be a request to close the multimedia room (CloseRoom), which is not specifically limited.
  • the client can be divided into different roles, and each role has different permissions.
  • the roles in the multimedia room can include host (Host), speaker (Speaker), audience ( Audience) and FollowedBySpeakers (FollowedBySpeakers) and so on.
  • the moderator has management rights such as speaking, inviting audiences to speak, and downgrading other moderators or speakers to listeners.
  • Spokesperson has the right to speak. The audience does not have the right to speak and can only listen to the speaker or the moderator, but they have the right to raise their hands to ask to speak.
  • the followed person is the person followed by the moderator and the speaker. The followed person has no right to speak and can only listen to the speech of the speaker or the moderator, but has the right to raise his hand to ask to speak, which is different from the audience in the interface display.
  • FIG. 1B it is a logical schematic diagram of switching roles in a multimedia room.
  • the audience can raise their hands to speak, and the host selects one or more audiences from the audience who raised their hands to invite to speak.
  • the host can also directly select any one or more audiences to invite to speak, and the invited audiences can become speakers after being confirmed.
  • Speakers can apply by themselves or be switched to listeners by the moderator.
  • the moderator can invite speakers to become the moderator, and the invited speakers can become the moderator after being confirmed.
  • the moderator can be selected randomly or according to the speaking order.
  • any host can switch other hosts as listeners. In some embodiments, if there are other presenters in the multimedia room, the presenter can switch to the audience by himself.
  • the status change request for the multimedia room may also be a request to switch roles of any client in the multimedia room. For example, raise your hand to speak (RaiseHand), cancel the raise of your hand to speak (UnRaiseHand), invite to speak (InviteToSpeaker), accept the speaking invitation (AcceptToSpeaker), reject the speaking invitation (RejectToSpeaker), host invitation (InviteToHost), Accept host invite requests (AcceptToHost), reject host invite requests (RejectToHost), demote speaker to listener requests (RemoveSpeaker), and demote host to listener requests (RemoveHost).
  • the state change request for the multimedia room may also be a microphone state switch request, for example, a request to open the microphone (OpenMic) and a request to close the microphone (CloseMic).
  • a microphone state switch request for example, a request to open the microphone (OpenMic) and a request to close the microphone (CloseMic).
  • the service server updates the first room information of the multimedia room according to the state change request.
  • the first room information is the room information of the multimedia room locally stored by the service server.
  • the room information may include a list of clients in the multimedia room, role information of each client, basic information of the multimedia room, and the like.
  • the client list may include one or more of the following information: a list of followed people (followedBySpeakers), a list of hosts (hosts), a list of listeners (listeners), and a list of speakers (speakers).
  • the information of each client in the client list may include one or more of the following information: avatar, nickname (nickname), id (userId), microphone status information (micOpen) and role information, wherein the role information includes the current Role information (currentUserRegion), hand raising status information (handRaise), and speaking invitation status information (invitedToSpeaker).
  • Basic information can include room id (channelId), room title (title), real-time communication room identifier (Real-time Communications Token) and video cloud service push stream address (Live Server push Stream Url).
  • the real-time communication room identifier is used to query the real-time communication room corresponding to the multimedia room from the real-time communication server (RTCServer).
  • RTCServer is used to provide real-time communication sending and receiving services, responsible for multimedia communication in the multimedia room and pushing multimedia data to the video cloud server (LiveServer) corresponding to the streaming address of the video cloud service.
  • LiveServer is used to accept real-time multimedia data stream, so as to realize real-time review and bypass recording.
  • the service server may update the stored first room information of the multimedia room according to the status change request.
  • the service server may add the first client to the client list in response to the status change request being the first client's request to join a room, so as to update the information of the first room; For the request of the client to leave the room, the service server can delete the first client from the client list to update the information of the first room; in response to the status change request being a request to close the room, the service server can delete the first client from the client list. delete from the client list to update the information of the first room.
  • the service server may update the role information of the first client according to the role switching request.
  • the role switch request may be a request for raising hands to speak or cancel the request for raising hands to speak, and the hand-raising status information of the first client may be updated accordingly;
  • the role switch request may be a request for an invitation to speak, and the invitation to speak of the first client may be updated correspondingly State information;
  • the role switching request can be a moderator invitation request, and the moderator invitation status information of the first client can be updated correspondingly;
  • the role switching request can be accepting a speaking invitation request, rejecting a speaking invitation request, accepting a moderator invitation request or rejecting a moderator Invitation requests from people can update the current role information of the first client correspondingly;
  • the role switching request can be a request to downgrade a speaker to an audience or a request to downgrade a moderator to an audience, and the current role information of the speaker or moderator can be updated correspondingly.
  • the service server may update the microphone state information of the first client according to the microphone state switching request.
  • the microphone state switch request may be a request to turn on the microphone or a request to turn off the microphone.
  • the state change request is a room creation request
  • the service server may generate basic information of the multimedia room according to the room creation request, and request real-time communication service information from the real-time communication server to obtain the first room information.
  • the service server returns a request result of the state change request to the first client.
  • the service server may return a request result of the state change request to the first client, and the request result is only applicable to whether the state change request sent by the first client is successful.
  • the request result returned by the service server may be room creation confirmation information, wherein, after the service server creates a multimedia room, the first client will not automatically join the created multimedia room , if the first client needs to join the multimedia room, it may further send a join room request to the service server to join the multimedia room.
  • the request result returned by the business server may be the first room information; in response to the state change request being a room leaving request, the request result returned by the business server may be confirmation information for leaving the room; in response to a state change If the request is a request to close a room, the request result returned by the business server may be confirmation information for leaving the room; in response to a status change request being a role switch request, the request result returned by the business server may be the request result of a role switch request; in response to a status change request of For the microphone state switching request, the request result returned by the service server may be microphone state switching confirmation information.
  • the first client executes an operation corresponding to the state change request in response to receiving the request result.
  • the first client in response to the first client receiving the first room information returned by the service server, which means that the request to join the multimedia room is successful, the first client may, according to the first The real-time communication service information in the room information establishes a connection with the real-time communication server, so that the real-time communication server provides multimedia data collection and streaming services; in response to the first client not receiving the first room information returned by the business server, that is Indicates that the request to join the multimedia room fails, and the first client may resend the request to the service server to join the room, or prompt the user to change the multimedia room, which is not specifically limited.
  • the state change request is a room leaving request
  • the first client in response to the first client receiving the leaving room confirmation information returned by the service server, which means that the request to leave the multimedia room is successful, the first client can send a disconnection message to the real-time communication server. connection request, so that the real-time communication server disconnects the connection with the first client; in response to the first client receiving the failure information of leaving the room returned by the business server, which means that the request to leave the multimedia room fails, the first client can re-apply to the The service server sends a request to leave the room, or prompts the user to fail to leave the multimedia room, which is not specifically limited.
  • the status change request is a room closing request
  • the first client in response to the first client receiving the leaving room confirmation information returned by the business server, which means that the request to close the multimedia room is successful, the first client can send a disconnection message to the real-time communication server. connection request, so that the real-time communication server disconnects the connection with the first client; in response to the first client receiving the failure information of leaving the room returned by the service server, that is, the request to close the multimedia room fails, the first client can re-apply to the The business server sends a request to close the room, or prompts the user to fail to close the multimedia room, which is not specifically limited.
  • the state change request is a microphone state switching request
  • the first client in response to the first client receiving the microphone state switching confirmation information returned by the service server, which means that the microphone state switching is successful, the first client can send a real-time communication to the real-time communication server Service request, so that the real-time communication server starts or stops the collection and pushing of multimedia data; in response to the first client receiving the microphone state switching failure information returned by the business server, that is, the request for microphone state switching fails, the first client
  • the microphone state switch request may be sent to the service server again, or the user may be prompted that the microphone state switch fails, which is not specifically limited.
  • the state change request is a role switching request
  • different role switching requests correspond to different operations.
  • the first client may request the real-time communication server for multimedia data collection and streaming services.
  • the service server generates an incremental message of the first room information, and sends the incremental message to the second client in the multimedia room through the persistent connection.
  • the persistent connection refers to a connection that can continuously send multiple data packets, and can be responsible for sending downlink messages and notification of timeout disconnection.
  • it can be a KwaiLink long connection. That is to say, when the first room information changes, the business server generates an incremental message, and then sends the incremental message to the second client through the long connection. If the first room information does not change, the business server does not send the incremental message. information.
  • the incremental message refers to the message used to indicate the incremental change of the first room information, that is, according to the incremental message, it can be determined what changes have taken place in the room information of the multimedia room, so that the device that receives the incremental message can
  • the room information of the multimedia room stored by itself is updated, and the updated room information is synchronized with the room information of the same multimedia room stored in the service server.
  • the service server can determine the version number of the currently generated incremental message according to the version number of the last incremental message, and then send the currently generated incremental message to the second client in the multimedia room through a long connection message and the corresponding version number. In this way, when the version number of the received incremental message is greater than the version number of the second room information, the second client will process the received incremental message and convert the received The version number of the incremental message is used as the version number of the updated second room information.
  • the version number of the incremental message may be expressed as roomVersion, and the version number of the incremental message may be in the form of pure numbers, for example, adding one to the version number of the previous incremental message to obtain a new version number.
  • the version number of the last incremental message may also be processed according to preset rules to obtain a new version number, which is not specifically limited.
  • the second client processes the latest incremental message according to the version number of the incremental message, which can reduce the number of two incremental messages
  • the order of receipt leads to the possibility of out-of-sequence.
  • the second client updates the second room information of the multimedia room according to the incremental message.
  • the second room information is the room information of the multimedia room locally stored by the second client.
  • the second room information may include all the information of the first room information, or only part of the information in the first room information, or may include different information in the first room information according to the role of the second client. , is not specifically limited.
  • the second client may perform corresponding operations according to the updated second room information. For example, in response to the update of the list of raising hands to speak in the second room information, the second client may select the first client from the list of raising hands to speak, and send an invitation request for the selected first client to speak to the service server .
  • the second client may send a heartbeat message to the service server at the first time interval to notify the service server of the online status of the second client.
  • the service server may decide to send The second client of the heartbeat message is currently online, and if no heartbeat message from any second client is received within the second time interval, the service server can determine that the second client has left the multimedia room, and then can update The client list in the first room information executes the step of generating an incremental message of the first room information.
  • the first time interval is the heartbeat sending interval time (heartbeatIntervalMs), which may be a global preset time of the service server, or may be included in the room information of the multimedia room, and be set according to different multimedia rooms.
  • the second time interval is not less than the first time interval, and may be a preset time, or a time determined according to the first time interval, which is not specifically limited.
  • the service server can update the client list in time, and when sending incremental messages, reduce the number of times incremental messages are sent, further reducing the processing pressure on the service server.
  • the second client may also detect the long connection with the service server according to the third time interval, and re-establish the long connection with the service server when the long connection is disconnected.
  • the third time interval may be the same as the first time interval.
  • the second client may take the opportunity of sending a heartbeat message to the service server to detect a long connection with the service server.
  • the third time interval The interval may also be different from the first time interval.
  • the second client may also separately send a persistent connection detection request to the service server, which is not specifically limited. In this way, the connection can be restored in time when the long connection is disconnected, thereby enhancing the stability of the long connection.
  • the second client may also send a room information acquisition request to the service server according to the fourth time interval, and the service server returns the first room information to the second client after receiving the room information acquisition request, and the second client will The received first room information is stored as new second room information.
  • the second client can periodically fetch the full amount of room information of the multimedia room from the service server.
  • the fourth time interval is relatively long, which can be expressed as syncFullIntervalMs.
  • the fourth time interval is greater than 5 minutes, so that the accuracy of the second room information in the second client can be ensured, and the processing pressure of the service server will not be increased.
  • the second client when the long connection between the service server and the second client is disconnected, the second client can send an incremental message acquisition request, and the incremental message acquisition request carries the version number of the second room information , if the version number of any incremental message is greater than the version number carried in the incremental message acquisition request, the business server returns the incremental message to the second client, or, if the version number of the incremental message is not greater than the incremental In the case of the version number carried in the message acquisition request, an incremental message acquisition result is returned to the second client after the fifth time interval.
  • the service server after the service server receives the incremental message acquisition request, it does not return the incremental message acquisition result immediately until the first room information changes and a new version number of the incremental message is generated, or until after the fifth time interval , the incremental message acquisition result is returned to the second client.
  • the fifth time interval is a longer period of time, which may be 1 minute.
  • the role change of each client may include but not limited to the following:
  • the first one is changing from audience to speaker: the audience client sends a request for raising hands to the business server, and after the business server updates the first room information, it sends an incremental message to the moderator client through a long connection, and the moderator
  • the client sends a speech invitation request to the business server, and the business server sends an incremental message to the audience client through a long connection.
  • the audience client sends a request to accept the invitation to the business server. After the request is successful, it requests the RTCServer to start recording and streaming.
  • the business server also sends incremental messages to other clients through the long connection to update the change of the listener's role.
  • the moderator client may also directly send the invitation to speak request to the service server, which is not specifically limited;
  • the second way is to change from a speaker to a moderator: the moderator client sends an invitation to the moderator client to the business server, and the business server sends an incremental message to the moderator client through a long connection, and the moderator client The client sends a request to accept the invitation to the business server, and the business server sends an incremental message to other clients to update the change of the role of the speaker client through the long connection;
  • the third way is to change from host to listener: the host client sends a request to downgrade any client to a listener to the business server, and after the business server updates the information of the first room, it sends an incremental message to the second room through a long connection. 2.
  • the client updates the change of the client's role;
  • the speaker client sends a request to reduce itself to a listener to the business server, and the business server updates the information of the first room and then sends an incremental message through a long connection Update the role change of the speaker client to other clients; in another case, the moderator client sends a request to downgrade the speaker client to a listener to the business server, and the business server updates the first room information and then notifies the long-term The connection sends an incremental message to other clients to update the change of the role of the speaker client.
  • the service server after the service server updates the information of the first room, it can generate and send an incremental message to the second client in the multimedia room, so that the second client can communicate with the second client in the multimedia room. Synchronization of the room information of the multimedia room stored in the business server, the second client can reduce the number of information acquisition requests sent to the business server, and also reduce the number of information acquisition requests received by the business server, thereby reducing the load on the business server pressure.
  • an information synchronization method applied to a first client includes the following steps: In S201, obtain a state change request for a multimedia room, and send the state change request to the service server; In S202, in response to receiving the request result, perform an operation corresponding to the state change request.
  • the service server may return the request result of the state change request to the first client, and send an incremental message of the first room information to the second client in the multimedia room through the persistent connection.
  • the second client may update the second room information according to the incremental message.
  • the first room information is the room information of the multimedia room locally stored by the business server
  • the second client is other clients in the multimedia room except the first client
  • the second room information is locally stored by the second client. Room information for the multimedia room.
  • the service server may add the first client to the client list according to the room joining request, and return the first room information to the first client.
  • the first room information includes a client list and real-time communication service information in the multimedia room.
  • the first client can establish a connection with the real-time communication server according to the real-time communication service information, so that the real-time communication server can provide multimedia data collection and streaming services.
  • the service server may delete the first client from the client list according to the room leaving request, and return room leaving confirmation information to the first client.
  • the first client may send a disconnection request to the real-time communication server in response to receiving the leaving room confirmation information, so that the real-time communication server disconnects the connection with the first client.
  • the service server may delete the first client from the client list, and return confirmation information about leaving the room to the first client.
  • the first client may send a disconnection request to the real-time communication server in response to receiving the leaving room confirmation information, so that the real-time communication server disconnects the connection with the first client.
  • the service server may update the microphone state information of the first client according to the microphone state switching request, and return microphone state switching confirmation information to the first client.
  • the first client may send a real-time communication service request to the real-time communication server in response to receiving the microphone state switching confirmation information, so that the real-time communication server starts or stops collecting and pushing multimedia data.
  • the service server in response to updating the information of the first room, can generate and send an incremental message to the second client in the multimedia room, so that the second client can communicate with the second client in the multimedia room. Synchronization of the room information of the multimedia room stored in the business server, the second client can reduce the number of information acquisition requests sent to the business server, and also reduce the number of information acquisition requests received by the business server, thereby reducing the load on the business server pressure.
  • an information synchronization method applied to a service server includes the following steps: in S301, receiving a state change request for a multimedia room sent by the first client; in S302, according to The state change request is to update the first room information of the multimedia room.
  • the first room information is the room information of the multimedia room locally stored by the business server; in S303, return the request result of the state change request to the first client, and generate the first
  • the incremental message of room information is sent to the second client in the multimedia room through the persistent connection, and the second client is other clients in the multimedia room except the first client.
  • the service server may generate basic information of the multimedia room according to the room creation request, and request real-time communication service information from the real-time communication server to obtain the first room information, And return room creation confirmation information to the first client.
  • the first room information when the state change request is a request to join a room, the first room information also includes a list of clients in the multimedia room, and the service server can add the first client to the list of clients according to the request to join a room. In the list, the first room information is returned to the first client, so that the first client establishes a connection with the real-time communication server according to the real-time communication service information, so that the real-time communication server provides multimedia data collection and streaming services.
  • the service server may delete the first client from the client list according to the room leaving request, and return room leaving confirmation information to the first client to The first client sends a disconnection request to the real-time communication server, so that the real-time communication server disconnects the connection with the first client.
  • the service server may delete the first client from the client list, and return a confirmation message for leaving the room to the first client, so that the first client A disconnection request is sent to the real-time communication server, so that the real-time communication server disconnects the connection with the first client.
  • the service server may update the role information of the first client according to the role switching request , returning the request result of the role switching request to the first client; further, the service server may only send an incremental message to the second client corresponding to the role switching request.
  • the service server may update the first client's microphone state information according to the microphone state switching request. Microphone state information of the terminal, and return microphone state switching confirmation information to the first client, so that the first client sends a real-time communication service request to the real-time communication server, so that the real-time communication server starts or stops the collection and push of multimedia data.
  • S303 return the request result of the state change request to the first client, and generate an incremental message of the first room information, and send the incremental message to the second client in the multimedia room through the long connection, the second client is other clients in the multimedia room except the first client.
  • the service server can determine the version number of the currently generated incremental message according to the version number of the last incremental message, and then send the currently generated incremental message to the second client in the multimedia room through a long connection message and the corresponding version number. In this way, when the version number of the received incremental message is greater than the version number of the second room information, the second client will process the received incremental message and convert the received The version number of the incremental message is used as the version number of the updated second room information.
  • the version number of the incremental message can be expressed as roomVersion, and the version number of the incremental message can be in the form of pure numbers. For example, add one to the version number of the previous incremental message to get a new version number.
  • the version number of the last incremental message may also be processed according to preset rules to calculate a new version number, which is not specifically limited.
  • the second client processes the latest incremental message according to the version number of the incremental message, which can reduce the number of two incremental messages
  • the order of receipt leads to the possibility of out-of-sequence.
  • the second client may send a heartbeat message to the service server at the first time interval to notify the service server of the online status of the second client.
  • the service server may decide to send The second client of the heartbeat message is currently online, and if no heartbeat message from any second client is received within the second time interval, the service server can determine that the second client has left the multimedia room, and then can update The client list in the first room information executes the step of generating an incremental message of the first room information.
  • the first time interval is the heartbeat sending interval time (heartbeatIntervalMs), which may be a global preset time of the service server, or may be included in the room information of the multimedia room, and be set according to different multimedia rooms.
  • the second time interval is not less than the first time interval, and may be a preset time, or a time determined according to the first time interval, which is not specifically limited.
  • the service server can update the client list in time, and when sending incremental messages, reduce the number of times incremental messages are sent, further reducing the processing pressure on the service server.
  • the second client may also detect the long connection with the service server according to the third time interval, and re-establish the long connection with the service server when the long connection is disconnected.
  • the third time interval may be the same as the first time interval.
  • the second client may take the opportunity of sending a heartbeat message to the service server to detect a long connection with the service server.
  • the third time interval The interval may also be different from the first time interval.
  • the second client may also separately send a persistent connection detection request to the service server, which is not specifically limited. In this way, the connection can be restored in time when the long connection is disconnected, thereby enhancing the stability of the long connection.
  • the second client may also send a room information acquisition request to the service server according to the fourth time interval, and the service server returns the first room information to the second client after receiving the room information acquisition request, and the second client will The received first room information is stored as new second room information.
  • the second client can regularly pull the full amount of room information of the multimedia room from the service server.
  • the fourth time interval is relatively long, which can be expressed as syncFullIntervalMs.
  • the fourth time interval is greater than 5 minutes, so It can not only ensure the accuracy of the second room information in the second client, but also not increase the processing pressure of the business server.
  • the second client when the long connection between the service server and the second client is disconnected, the second client can send an incremental message acquisition request, and the incremental message acquisition request carries the version number of the second room information , when the version number of any incremental message is greater than the version number carried in the incremental message acquisition request, the business server returns the incremental message to the second client, or, if the version number of the incremental message is not greater than the incremental message In the case of the version number carried in the message acquisition request, an incremental message acquisition result is returned to the second client after the fifth time interval.
  • the service server after the service server receives the incremental message acquisition request, it does not return the incremental message acquisition result immediately until the first room information changes and a new version number of the incremental message is generated, or until after the fifth time interval , the incremental message acquisition result is returned to the second client.
  • the fifth time interval is a longer period of time, which may be 1 minute.
  • the service server in response to updating the information of the first room, can generate and send an incremental message to the second client in the multimedia room, so that the second client can communicate with the second client in the multimedia room. Synchronization of the room information of the multimedia room stored in the business server, the second client can reduce the number of information acquisition requests sent to the business server, and also reduce the number of information acquisition requests received by the business server, thereby reducing the load on the business server pressure.
  • an information synchronization method applied to the second client includes the following steps: In S401, receiving the incremental message of the first room information sent by the service server through the persistent connection; in S402 In this method, the second room information of the multimedia room is updated according to the incremental message, where the second room information is the room information of the multimedia room locally stored by the second client.
  • the first room information is the room information of the multimedia room locally stored by the service server
  • the incremental message is generated by the service server after updating the first room information of the multimedia room according to the state change request sent by the first client.
  • a long connection refers to a connection that can continuously send multiple data packets, and can be responsible for sending downlink messages and notification of timeout disconnection, for example, it can be a KwaiLink long connection. That is to say, when the first room information changes, the business server generates an incremental message, and then sends the incremental message to the second client through the long connection. If the first room information does not change, the business server does not send the incremental message. information.
  • the incremental message refers to the message used to indicate the incremental change of the first room information, that is, according to the incremental message, it can be determined what changes have taken place in the room information of the multimedia room, so that the device that receives the incremental message can
  • the room information of the multimedia room stored by itself is updated, and the updated room information is synchronized with the room information of the same multimedia room stored in the service server.
  • the second client in response to updating the second room information of the multimedia room, the second client may perform a corresponding operation according to the updated second room information. For example, in response to the update of the list of raising hands to speak in the second room information, the second client may select the first client from the list of raising hands to speak, and send an invitation request for the selected first client to speak to the service server .
  • the service server can determine the version number of the currently generated incremental message according to the version number of the last incremental message, and then send the currently generated incremental message to the second client in the multimedia room through a long connection message and the corresponding version number. In this way, when the version number of the received incremental message is greater than the version number of the second room information, the second client will process the received incremental message and convert the received The version number of the incremental message is used as the version number of the updated second room information.
  • the version number of the incremental message can be expressed as roomVersion, and the version number of the incremental message can be in the form of pure numbers. For example, add one to the version number of the previous incremental message to get a new version number.
  • the version number of the last incremental message may also be processed according to preset rules to calculate a new version number, which is not specifically limited.
  • the second client processes the latest incremental message according to the version number of the incremental message, which can reduce the number of two incremental messages
  • the order of receipt leads to the possibility of out-of-sequence.
  • the second client may send a heartbeat message to the service server at the first time interval to notify the service server of the online status of the second client.
  • the service server may decide to send The second client of the heartbeat message is currently online, and if no heartbeat message from any second client is received within the second time interval, the service server can determine that the second client has left the multimedia room, and then can update The client list in the first room information executes the step of generating an incremental message of the first room information.
  • the first time interval is the heartbeat sending interval time (heartbeatIntervalMs), which may be a global preset time of the service server, or may be included in the room information of the multimedia room, and be set according to different multimedia rooms.
  • the second time interval is not less than the first time interval, and may be a preset time, or a time determined according to the first time interval, which is not specifically limited.
  • the service server can update the client list in time, and when sending incremental messages, reduce the number of times incremental messages are sent, further reducing the processing pressure on the service server.
  • the second client may also detect the long connection with the service server according to the third time interval, and re-establish the long connection with the service server when the long connection is disconnected.
  • the third time interval may be the same as the first time interval.
  • the second client may take the opportunity of sending a heartbeat message to the service server to detect a long connection with the service server.
  • the third time interval The interval may also be different from the first time interval.
  • the second client may also separately send a persistent connection detection request to the service server, which is not specifically limited. In this way, the connection can be restored in time when the long connection is disconnected, thereby enhancing the stability of the long connection.
  • the second client may also send a room information acquisition request to the service server according to the fourth time interval, and the service server returns the first room information to the second client after receiving the room information acquisition request, and the second client will The received first room information is stored as new second room information.
  • the second client can periodically fetch the full amount of room information of the multimedia room from the service server.
  • the fourth time interval is relatively long, which can be expressed as syncFullIntervalMs.
  • the fourth time interval is greater than 5 minutes, so that the accuracy of the second room information in the second client can be ensured, and the processing pressure of the service server will not be increased.
  • the second client when the long connection between the service server and the second client is disconnected, the second client can send an incremental message acquisition request, and the incremental message acquisition request carries the version number of the second room information , when the version number of any incremental message is greater than the version number carried in the incremental message acquisition request, the business server returns the incremental message to the second client, or, if the version number of the incremental message is not greater than the incremental message In the case of the version number carried in the message acquisition request, an incremental message acquisition result is returned to the second client after the fifth time interval.
  • the service server after the service server receives the incremental message acquisition request, it does not return the incremental message acquisition result immediately until the first room information changes and a new version number of the incremental message is generated, or until after the fifth time interval , the incremental message acquisition result is returned to the second client.
  • the fifth time interval is a longer period of time, which may be 1 minute.
  • the service server in response to the information of the first room being updated, can generate and send an incremental message to the second client in the multimedia room, so that the second client can implement With the synchronization of the room information of the multimedia room stored in the service server, the second client can reduce the number of information acquisition requests sent to the service server, and also reduce the number of information acquisition requests received by the service server, thereby reducing the workload of the service server. load pressure.
  • an information synchronization device applied to a first client includes an obtaining unit 501 and a first receiving unit 502 .
  • the obtaining unit 501 is configured to obtain a state change request for a multimedia room, and send the state change request to a service server, so that the service server returns a request result of the state change request to the first client, and Send an incremental message of the first room information to the second client in the multimedia room through a long connection, and make the second client update the second room information according to the incremental message,
  • the first room information is the The room information of the multimedia room locally stored by the service server
  • the second room information is the room information of the multimedia room locally stored by the second client.
  • the first receiving unit 502 is configured to execute an operation corresponding to the state change request in response to receiving the request result.
  • the service server in response to the information of the first room being updated, can generate and send an incremental message to the second client in the multimedia room, so that the second client can implement With the synchronization of the room information of the multimedia room stored in the service server, the second client can reduce the number of information acquisition requests sent to the service server, and also reduce the number of information acquisition requests received by the service server, thereby reducing the workload of the service server. load pressure.
  • an information synchronization device applied to a service server includes a second receiving unit 601 , a first updating unit 602 and a sending unit 603 .
  • the second receiving unit 601 is configured to receive a state change request for a multimedia room sent by a first client.
  • the first updating unit 602 is configured to update the first room information of the multimedia room according to the state change request, where the first room information is the room information of the multimedia room locally stored by the service server.
  • the sending unit 603 is configured to return the request result of the state change request to the first client, and generate an incremental message of the first room information, and send it to the second client in the multimedia room through a long connection Send the incremental message.
  • the service server in response to the information of the first room being updated, can generate and send an incremental message to the second client in the multimedia room, so that the second client can implement With the synchronization of the room information of the multimedia room stored in the service server, the second client can reduce the number of information acquisition requests sent to the service server, and also reduce the number of information acquisition requests received by the service server, thereby reducing the workload of the service server. load pressure.
  • an information synchronization device applied to a second client includes a third receiving unit 701 and a second updating unit 702 .
  • the third receiving unit 701 is configured to receive the incremental message of the first room information sent by the service server through the persistent connection, the first room information is the room information of the multimedia room locally stored by the service server, and the incremental message is The volume message is generated by the service server after updating the first room information of the multimedia room according to the state change request sent by the first client;
  • the second updating unit 702 is configured to update the second room information of the multimedia room according to the incremental message, where the second room information is the room information of the multimedia room locally stored by the second client.
  • the service server in response to the information of the first room being updated, can generate and send an incremental message to the second client in the multimedia room, so that the second client can implement With the synchronization of the room information of the multimedia room stored in the service server, the second client can reduce the number of information acquisition requests sent to the service server, and also reduce the number of information acquisition requests received by the service server, thereby reducing the workload of the service server. load pressure.
  • Fig. 8 is a block diagram of another device 800 according to an exemplary embodiment.
  • apparatus 800 may be a mobile phone, computer, digital broadcast electronics, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, and the like.
  • the device 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and communication component 816 .
  • the processing component 802 generally controls the overall operations of the device 800, such as those associated with display, telephone calls, data communications, camera operations, and recording operations.
  • the processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802 .
  • the memory 804 is configured to store various types of data to support operations at the device 800 . Examples of such data include instructions for any application or method operating on device 800, contact data, phonebook data, messages, pictures, videos, and the like.
  • the memory 804 can be implemented by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read-only memory
  • EPROM erasable Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • Magnetic or Optical Disk Magnetic Disk
  • the power supply component 807 provides power to the various components of the device 800 .
  • Power components 807 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for device 800 .
  • the multimedia component 808 includes a screen that provides an output interface between the device 800 and the user.
  • the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user.
  • the touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense a boundary of a touch or swipe action, but also detect duration and pressure associated with the touch or swipe action.
  • the multimedia component 808 includes a front camera and/or a rear camera. When the device 800 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capability.
  • the audio component 810 is configured to output and/or input audio signals.
  • the audio component 810 includes a microphone (MIC), which is configured to receive external audio signals when the device 800 is in operation modes, such as call mode, recording mode and voice recognition mode. Received audio signals may be further stored in memory 404 or sent via communication component 816 .
  • the audio component 810 also includes a speaker for outputting audio signals.
  • the I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, and the like. These buttons may include, but are not limited to: a home button, volume buttons, start button, and lock button.
  • Sensor assembly 814 includes one or more sensors for providing status assessments of various aspects of device 800 .
  • the sensor component 814 can detect the open/closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor component 814 can also detect a change in the position of the device 800 or a component of the device 800 , the presence or absence of user contact with the device 800 , the device 800 orientation or acceleration/deceleration and the temperature change of the device 800 .
  • Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact.
  • Sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
  • the sensor component 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor.
  • the communication component 816 is configured to facilitate wired or wireless communication between the apparatus 800 and other devices.
  • the device 800 can access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G or 5G), or a combination thereof.
  • the communication component 416 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication.
  • the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID Radio Frequency Identification
  • IrDA Infrared Data Association
  • UWB Ultra Wide Band
  • Bluetooth Bluetooth
  • apparatus 800 may be programmed by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable Implementation of a gate array (FPGA), controller, microcontroller, microprocessor or other electronic components for performing any of the information synchronization methods described above.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable Implementation of a gate array
  • controller microcontroller, microprocessor or other electronic components for performing any of the information synchronization methods described above.
  • a non-transitory computer-readable storage medium including instructions, such as the memory 804 including instructions, which can be executed by the processor 820 of the device 800 to implement the above method.
  • the storage medium may be a non-transitory computer-readable storage medium, for example, the non-transitory non-transitory computer-readable storage medium may be a ROM, a random access memory (RAM) ), CD-ROM, tape, floppy disk and optical data storage devices, etc.
  • FIG. 9 it is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • a computer-readable storage medium including instructions, such as a memory including instructions, which can be executed by a processor of an electronic device to implement the above method.
  • the computer readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.
  • a computer program product is also provided, which, when run on a computer, enables the computer to implement the above method for playing multimedia data.
  • the present disclosure also provides a storage medium.
  • the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute any one of the above information synchronization methods.
  • the present disclosure also provides a computer program product containing instructions, which, when run on a computer, enables the computer to implement any one of the above information synchronization methods.
  • the service server in response to the information of the first room being updated, can generate and send an incremental message to the second client in the multimedia room, so that the second client can implement With the synchronization of the room information of the multimedia room stored in the service server, the second client can reduce the number of information acquisition requests sent to the service server, and also reduce the number of information acquisition requests received by the service server, thereby reducing the workload of the service server. load pressure.
  • any references to memory, storage, database or other media used in the various embodiments provided in the present application may include non-volatile and/or volatile memory.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Information Transfer Between Computers (AREA)
  • Telephonic Communication Services (AREA)

Abstract

本公开关于一种信息同步系统、方法及设备。该方法包括:第一客户端获取针对多媒体房间的状态变更请求,将状态变更请求发送至业务服务器;业务服务器根据状态变更请求,更新多媒体房间的第一房间信息,向第一客户端返回状态变更请求的请求结果,并生成第一房间信息的增量消息,通过长连接向多媒体房间内的第二客户端发送增量消息;第一客户端响应于接收到请求结果来执行状态变更请求对应的操作;第二客户端根据增量消息,更新多媒体房间的第二房间信息,第二房间信息为第二客户端本地存储的多媒体房间的房间信息。这样,减少了业务服务器接收到的信息获取请求的数量,从而减轻了业务服务器的负载压力。

Description

一种信息同步系统、方法、及设备
相关申请的交叉引用
本公开要求于2021年8月17日递交的中国专利申请第202110943989.X号的优先权,在此全文引用上述中国专利申请公开的内容以作为本申请的一部分。
技术领域
本公开涉及视频直播领域,特别是涉及一种信息同步系统、方法及设备。
背景技术
在一个多媒体房间内,通常有多个客户端同时在线,客户端在多媒体房间内可以打开麦克风、关闭麦克风或切换角色,还可以离开多媒体房间或关闭多媒体房间,另外,还有其他客户端可以申请加入多媒体房间,等等。在同一多媒体房间内的客户端需要对多媒体房间的状态信息进行同步,以确定多媒体房间内其他客户端的实时状态。
目前,通常由客户端定时向服务器发送信息获取请求,从服务器全量拉取并更新多媒体房间的状态信息。但是,一些场景下,服务器可能需要同时为多个多媒体房间提供服务,每个多媒体房间内的客户端数量也可能比较多,因此,服务器会在同一时间内接收到大量的信息获取请求,给服务器造成较大的负载压力,进而可能导致服务器崩溃等问题。
发明内容
为了解决相关技术中存在的服务器会在同一时间内接收到大量的信息获取请求,负载压力过大的问题,本公开提供了一种信息同步系统、方法及设备。
根据本公开实施例的第一方面,提供了一种信息同步系统,所述系统包括:
第一客户端,用于获取针对多媒体房间的状态变更请求,将所述状态变更请求发送至业务服务器;
所述业务服务器,用于根据所述状态变更请求,更新所述多媒体房间的第一房间信息,向所述第一客户端返回所述状态变更请求的请求结果,并生成所述第一房间信息的增量消息,通过长连接向所述多媒体房间内的第二客户端发送所述增量消息,所述第一房间信息为所述业务服务器本地存储的所述多媒体房间的房间信息;
其中,所述第一客户端还用于响应于接收到所述请求结果,执行所述状态变更请求对应的操作;
其中所述第二客户端用于根据所述增量消息,更新所述多媒体房间的第二房间信息,所述第二房间信息为所述第二客户端本地存储的所述多媒体房间的房间信息。
在一些实施例中,所述业务服务器用于根据上一条增量消息的版本号,确定当前生成的增量消息的版本号,通过长连接向所述多媒体房间内的第二客户端发送当前生成的增量消息及对应的版本号;
所述第二客户端用于响应于接收到的增量消息的版本号大于所述第二房间信息的版本号,根据接收到的增量消息,更新所述第二房间信息,并将接收到的增量消息的版本号作为更新后的所述第二房间信息的版本号。
在一些实施例中,所述第二客户端还用于按照第一时间间隔,向所述业务服务器发送心跳消息;
所述业务服务器还用于响应于在第二时间间隔内未接收到任一所述第二客户端的心跳消息,判定该第二客户端离开所述多媒体房间,更新所述第一房间信息中的客户端列表,执行所述生成所述第一房间信息的增量消息的步骤。
在一些实施例中,所述第二客户端还用于按照第三时间间隔,检测与所述业务服务器之间的长连接,响应于检测到所述长连接断开,重新与所述业务服务器建立长连接。
在一些实施例中,所述第二客户端还用于按照第四时间间隔,向所述业务服务器发送房间信息获取请求;
所述业务服务器还用于在接收到所述房间信息获取请求后,向所述第二客户端返回所述第一房间信息;
所述第二客户端还用于将接收到的第一房间信息存储为新的第二房间信息。
在一些实施例中,响应于检测到所述业务服务器与所述第二客户端之间的长连接断开,
所述第二客户端还用于发送增量消息获取请求,所述增量消息获取请求携带所述第二房间信息的版本号;
所述业务服务器还用于响应于任一增量消息的版本号大于所述增量消息获取请求携带的版本号,向所述第二客户端返回该增量消息;或,响应于增量消息的版本号均不大于所述增量消息获取请求携带的版本号,在第五时间间隔之后,向所述第二客户端返回增量消息获取结果。
在一些实施例中,所述第二客户端还用于在更新所述多媒体房间的第二房间信息后,根据更新后的第二房间信息执行相应的操作。
在一些实施例中,所述状态变更请求为创建房间请求;
所述业务服务器用于根据所述创建房间请求,生成多媒体房间的基本信息,并向实时通信服务器请求实时通信服务信息,得到第一房间信息,并向所述第一客户端返回创建房间确认信息。
在一些实施例中,所述状态变更请求为加入房间请求,所述第一房间信息中还包括所述多媒体房间内的客户端列表;
所述业务服务器用于根据所述加入房间请求,将所述第一客户端添加至所述客户端列表中,向所述第一客户端返回所述第一房间信息;
所述第一客户端用于根据所述实时通信服务信息,与实时通信服务器建立连接,以使所述实时通信服务器提供多媒体数据的采集和推流服务。
在一些实施例中,所述状态变更请求为离开房间请求;
所述业务服务器用于根据所述离开房间请求,将所述第一客户端从所述客户端列表中删除,向所述第一客户端返回离开房间确认信息;
所述第一客户端用于响应于接收到所述离开房间确认信息,向所述实时通信服务器发送断开连接请求,以使所述实时通信服务器断开与所述第一客户端的连接。
在一些实施例中,所述状态变更请求为关闭房间请求;
所述业务服务器用于将所述第一客户端从所述客户端列表中删除,向所述第一客户端返回离开房间确认信息;
所述第一客户端用于响应于接收到所述离开房间确认信息,向所述实时通信服务器发送断开连接请求,以使所述实时通信服务器断开与所述第一客户端的连接。
在一些实施例中,所述状态变更请求为角色切换请求,所述第一房间信息中还包括所述多媒体房间内每个客户端的角色信息;
所述业务服务器用于根据所述角色切换请求,更新所述第一客户端的角色信息,向所述第一客户端返回所述角色切换请求的请求结果,并生成所述第一房间信息的增量消息,通过长连接向所述角色切换请求对应的第二客户端发送所述增量消息。
在一些实施例中,所述状态变更请求为麦克风状态切换请求,所述第一房间信息中还包括所述多媒体房间内每个客户端的麦克风状态信息:
所述业务服务器用于根据所述麦克风状态切换请求,更新所述第一客户端的麦克风状 态信息,向所述第一客户端返回麦克风状态切换确认信息;
所述第一客户端用于响应于接收到所述麦克风状态切换确认信息,向实时通信服务器发送实时通信服务请求,以使所述实时通信服务器开始或停止多媒体数据的采集和推流。
根据本公开实施例的第二方面,提供了一种信息同步方法,应用于第一客户端,所述方法包括:获取针对多媒体房间的状态变更请求,将所述状态变更请求发送至业务服务器,以使所述业务服务器向所述第一客户端返回所述状态变更请求的请求结果,并通过长连接向所述多媒体房间内的第二客户端发送第一房间信息的增量消息,并使第二客户端根据所述增量消息更新第二房间信息,所述第一房间信息为所述业务服务器本地存储的所述多媒体房间的房间信息,所述第二房间信息为所述第二客户端本地存储的所述多媒体房间的房间信息;响应于接收到所述请求结果,执行所述状态变更请求对应的操作。
在一些实施例中,响应于所述状态变更请求为加入房间请求,所述业务服务器根据所述加入房间请求,将所述第一客户端添加至所述客户端列表中,向所述第一客户端返回所述第一房间信息,所述第一房间信息中包括所述多媒体房间内的客户端列表及实时通信服务信息;
所述响应于接收到所述请求结果,执行所述状态变更请求对应的操作,包括:
根据所述实时通信服务信息,与实时通信服务器建立连接,以使所述实时通信服务器提供多媒体数据的采集和推流服务。
在一些实施例中,响应于所述状态变更请求为离开房间请求,所述业务服务器根据所述离开房间请求,将所述第一客户端从所述客户端列表中删除,向所述第一客户端返回离开房间确认信息;
所述响应于接收到所述请求结果,执行所述状态变更请求对应的操作,包括:
响应于接收到所述离开房间确认信息,向所述实时通信服务器发送断开连接请求,以使所述实时通信服务器断开与所述第一客户端的连接。
在一些实施例中,响应于所述状态变更请求为关闭房间请求,所述业务服务器将所述第一客户端从所述客户端列表中删除,向所述第一客户端返回离开房间确认信息;
所述响应于接收到所述请求结果,执行所述状态变更请求对应的操作,包括:
响应于接收到所述离开房间确认信息,向所述实时通信服务器发送断开连接请求,以使所述实时通信服务器断开与所述第一客户端的连接。
在一些实施例中,响应于所述状态变更请求为麦克风状态切换请求,所述业务服务器根据所述麦克风状态切换请求更新所述第一客户端的麦克风状态信息,向所述第一客户端返回麦克风状态切换确认信息;
所述响应于在接收到所述请求结果,执行所述状态变更请求对应的操作,包括:
响应于接收到所述麦克风状态切换确认信息,向实时通信服务器发送实时通信服务请求,以使所述实时通信服务器开始或停止多媒体数据的采集和推流。
根据本公开实施例的第三方面,提供了一种信息同步方法,应用于业务服务器,所述方法包括:
接收第一客户端发送的针对多媒体房间的状态变更请求;
根据所述状态变更请求,更新所述多媒体房间的第一房间信息,所述第一房间信息为所述业务服务器本地存储的所述多媒体房间的房间信息;
向所述第一客户端返回所述状态变更请求的请求结果,并生成所述第一房间信息的增量消息,通过长连接向所述多媒体房间内的第二客户端发送所述增量消息。
在一些实施例中,所述生成所述第一房间信息的增量消息,通过长连接向所述多媒体房间内的第二客户端发送所述增量消息,包括:
根据上一条增量消息的版本号,确定当前生成的增量消息的版本号;
通过长连接向所述多媒体房间内的第二客户端发送当前生成的增量消息及对应的版 本号,以使响应于所述第二客户端在接收到的增量消息的版本号大于所述第二房间信息的版本号,根据接收到的增量消息更新所述第二房间信息,并将接收到的增量消息的版本号作为更新后的所述第二房间信息的版本号。
在一些实施例中,所述方法还包括:响应于在第二时间间隔内未接收到任一所述第二客户端的心跳消息,判定该第二客户端离开所述多媒体房间,更新所述第一房间信息中的客户端列表,执行所述生成所述第一房间信息的增量消息的步骤。
在一些实施例中,所述方法还包括:在接收到任一所述第二客户端发送的房间信息获取请求后,向该第二客户端返回所述第一房间信息,以使所述第二客户端将接收到的第一房间信息存储为新的第二房间信息。
在一些实施例中,响应于检测到所述业务服务器与所述第二客户端之间的长连接断开,所述方法还包括:接收任一所述第二客户端发送的增量消息获取请求,所述增量消息获取请求携带该第二客户端存储的第二房间信息的版本号;响应于任一增量消息的版本号大于所述增量消息获取请求携带的版本号,向所述第二客户端返回该增量消息;或,响应于增量消息的版本号均不大于所述增量消息获取请求携带的版本号,在第五时间间隔之后,向所述第二客户端返回增量消息获取结果。
在一些实施例中,响应于所述状态变更请求为创建房间请求,所述方法还包括:所述业务服务器根据所述创建房间请求,生成多媒体房间的基本信息,并向实时通信服务器请求实时通信服务信息,得到第一房间信息,并向所述第一客户端返回创建房间确认信息。
在一些实施例中,响应于所述状态变更请求为加入房间请求,所述第一房间信息中还包括所述多媒体房间内的客户端列表,所述根据所述状态变更请求,更新所述多媒体房间的第一房间信息,向所述第一客户端返回所述状态变更请求的请求结果,包括:根据所述加入房间请求,将所述第一客户端添加至所述客户端列表中,向所述第一客户端返回所述第一房间信息,以使所述第一客户端根据所述实时通信服务信息与实时通信服务器建立连接,以使所述实时通信服务器提供多媒体数据的采集和推流服务。
在一些实施例中,响应于所述状态变更请求为离开房间请求,所述根据所述状态变更请求,更新所述多媒体房间的第一房间信息,向所述第一客户端返回所述状态变更请求的请求结果,包括:根据所述离开房间请求,将所述第一客户端从所述客户端列表中删除,向所述第一客户端返回离开房间确认信息,以使所述第一客户端向所述实时通信服务器发送断开连接请求,以使所述实时通信服务器断开与所述第一客户端的连接。
在一些实施例中,响应于所述状态变更请求为关闭房间请求,所述根据所述状态变更请求,更新所述多媒体房间的第一房间信息,向所述第一客户端返回所述状态变更请求的请求结果,包括:将所述第一客户端从所述客户端列表中删除,向所述第一客户端返回离开房间确认信息,以使所述第一客户端向所述实时通信服务器发送断开连接请求,以使所述实时通信服务器断开与所述第一客户端的连接。
在一些实施例中,响应于所述状态变更请求为角色切换请求,且所述第一房间信息中还包括所述多媒体房间内每个客户端的角色信息,
所述根据所述状态变更请求,更新所述多媒体房间的第一房间信息,向所述第一客户端返回所述状态变更请求的请求结果,包括:根据所述角色切换请求,更新所述第一客户端的角色信息,向所述第一客户端返回所述角色切换请求的请求结果;
所述生成所述第一房间信息的增量消息,通过长连接向所述多媒体房间内的第二客户端发送所述增量消息,包括:生成所述第一房间信息的增量消息,通过长连接向所述角色切换请求对应的第二客户端发送所述增量消息。
在一些实施例中,响应于所述状态变更请求为麦克风状态切换请求,且所述第一房间信息中还包括所述多媒体房间内每个客户端的麦克风状态信息,
所述根据所述状态变更请求,更新所述多媒体房间的第一房间信息,向所述第一客户 端返回所述状态变更请求的请求结果,包括:根据所述麦克风状态切换请求,更新所述第一客户端的麦克风状态信息,向所述第一客户端返回麦克风状态切换确认信息,以使所述第一客户端向实时通信服务器发送实时通信服务请求,以使所述实时通信服务器开始或停止多媒体数据的采集和推流。
根据本公开实施例的第四方面,提供了一种信息同步方法,应用于第二客户端,所述方法包括:
接收业务服务器通过长连接发送的第一房间信息的增量消息,所述第一房间信息为所述业务服务器本地存储的所述多媒体房间的房间信息,所述增量消息为所述业务服务器根据第一客户端发送的状态变更请求更新所述多媒体房间的第一房间信息后生成的;
根据所述增量消息,更新所述多媒体房间的第二房间信息,所述第二房间信息为所述第二客户端本地存储的所述多媒体房间的房间信息。
在一些实施例中,所述根据所述增量消息,更新所述多媒体房间的第二房间信息,包括:响应于接收到的增量消息的版本号大于所述第二房间信息的版本号,根据接收到的增量消息,更新所述第二房间信息,并将接收到的增量消息的版本号作为更新后的所述第二房间信息的版本号。
在一些实施例中,所述方法还包括:按照第一时间间隔,向所述业务服务器发送心跳消息,以使响应于所述业务服务器在第二时间间隔内未接收到任一所述第二客户端的心跳消息,将该第二客户端从所述第一房间信息的客户端列表中删除,并执行所述生成所述第一房间信息的增量消息的步骤。
在一些实施例中,所述方法还包括:按照第三时间间隔,检测与所述业务服务器之间的长连接,以及响应于检测到在所述长连接断开,重新与所述业务服务器建立长连接。
在一些实施例中,所述方法还包括:按照第四时间间隔,向所述业务服务器发送房间信息获取请求,以使所述业务服务器返回所述第一房间信息;
将接收到的第一房间信息存储为新的第二房间信息。
在一些实施例中,响应于检测到所述业务服务器与所述第二客户端之间的长连接断开,所述方法还包括:发送增量消息获取请求,所述增量消息获取请求携带所述第二房间信息的版本号,以使响应于所述业务服务器在任一增量消息的版本号大于所述增量消息获取请求携带的版本号,向所述第二客户端返回该增量消息,或响应于增量消息的版本号均不大于所述增量消息获取请求携带的版本号,在第五时间间隔之后,向所述第二客户端返回增量消息获取结果。
在一些实施例中,在更新所述多媒体房间的第二房间信息后,所述方法还包括:根据更新后的第二房间信息执行相应的操作。
根据本公开实施例的第五方面,提供了一种信息同步装置,应用于第一客户端,所述装置包括:
获取单元,被配置为获取针对多媒体房间的状态变更请求,将所述状态变更请求发送至业务服务器,以使所述业务服务器向所述第一客户端返回所述状态变更请求的请求结果,并通过长连接向所述多媒体房间内的第二客户端发送第一房间信息的增量消息,并使第二客户端根据所述增量消息更新第二房间信息,所述第一房间信息为所述业务服务器本地存储的所述多媒体房间的房间信息,所述第二房间信息为所述第二客户端本地存储的所述多媒体房间的房间信息;
第一接收单元,被配置为响应于接收到所述请求结果,执行所述状态变更请求对应的操作。
根据本公开实施例的第六方面,提供了一种信息同步装置,应用于业务服务器,所述装置包括:
第二接收单元,被配置为接收第一客户端发送的针对多媒体房间的状态变更请求;
第一更新单元,被配置为根据所述状态变更请求,更新所述多媒体房间的第一房间信息,所述第一房间信息为所述业务服务器本地存储的所述多媒体房间的房间信息;
发送单元,被配置为向所述第一客户端返回所述状态变更请求的请求结果,并生成所述第一房间信息的增量消息,通过长连接向所述多媒体房间内的第二客户端发送所述增量消息。
根据本公开实施例的第七方面,提供了一种信息同步装置,应用于第二客户端,所述装置包括:
第三接收单元,被配置为接收业务服务器通过长连接发送的第一房间信息的增量消息,所述第一房间信息为所述业务服务器本地存储的所述多媒体房间的房间信息,所述增量消息为所述业务服务器根据第一客户端发送的状态变更请求更新所述多媒体房间的第一房间信息后生成的;
第二更新单元,被配置为根据所述增量消息,更新所述多媒体房间的第二房间信息,所述第二房间信息为所述第二客户端本地存储的所述多媒体房间的房间信息。
根据本公开实施例的第八方面,还提供了一种电子设备,包括:处理器;用于存储所述处理器可执行指令的存储器;其中,所述处理器被配置为执行所述指令,以实现第二或第三方面所述的方法。
根据本公开实施例的第九方面,还提供了一种非易失性存储介质,当所述非易失性存储介质中的指令由电子设备的处理器执行时,使得所述电子设备能够执行第二方面或第三方面所述的方法。
根据本公开实施例的第十方面,提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机实现第二方面或第三方面所述的方法。
本公开实施例提供的技术方案中,第一客户端获取针对多媒体房间的状态变更请求,将状态变更请求发送至业务服务器;业务服务器根据状态变更请求,更新多媒体房间的第一房间信息,向第一客户端返回状态变更请求的请求结果,并生成第一房间信息的增量消息,通过长连接向多媒体房间内的第二客户端发送增量消息,第一房间信息为业务服务器本地存储的多媒体房间的房间信息,第二客户端为多媒体房间内除第一客户端之外的其他客户端;第一客户端响应于接收到请求结果来执行状态变更请求对应的操作;第二客户端根据增量消息,更新多媒体房间的第二房间信息,第二房间信息为第二客户端本地存储的多媒体房间的房间信息。
这样,业务服务器在更新第一房间信息之后,可以通过生成并向多媒体房间内的第二客户端发送增量消息,就可以实现第二客户端与业务服务器中存储的多媒体房间的房间信息的同步,第二客户端可以减少向业务服务器发送信息获取请求的次数,也减少了业务服务器接收到的信息获取请求的数量,从而减轻了业务服务器的负载压力。
附图说明
图1A是根据本公开的一些实施例示出的一种信息同步系统的交互示意图;
图1B是根据本公开的一些实施例示出的一种多媒体房间内各角色的切换逻辑示意图;
图2是根据本公开的一些实施例示出的一种应用于第一客户端的方法的流程图;
图3是根据本公开的一些实施例示出的一种应用于业务服务器的方法的流程图;
图4是根据本公开的一些实施例示出的一种应用于第二客户端的方法的流程图;
图5是根据本公开的一些实施例示出的一种应用于第一客户端的装置的框图;
图6是根据本公开的一些实施例示出的一种应用于业务服务器的装置的框图;
图7是根据本公开的一些实施例示出的一种应用于第二客户端的装置的框图;
图8是根据本公开的一些实施例示出的一种装置的框图;
图9是根据本公开的一些实施例示出的一种电子设备的结构示意图。
具体实施方式
为了使本领域普通人员更好地理解本公开的技术方案,下面将结合附图,对本公开实施例中的技术方案进行清楚、完整地描述。
需要说明的是,本公开的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本公开的实施例能够以除了在这里图示或描述的那些以外的顺序实施。以下示例性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。
为了解决相关技术中存在的服务器会在同一时间内接收到大量的信息获取请求,负载压力过大的问题,本公开实施例提供了一种信息同步系统、方法、装置、设备及存储介质。
下面将对本公开实施例提供的一种信息同步系统进行详细介绍。
如图1A所示,本公开实施例提供的一种信息同步系统的系统交互图,该信息同步系统包括第一客户端、业务服务器和第二客户端。
其中,业务服务器即为WebServer,负责维护多媒体房间的状态和所有上行消息接受和下行消息分发,第一客户端和第二客户端即为Client,Client可以与用户进行交互。
为了便于描述,在本公开中,将发送状态变更请求的客户端称为第一客户端,第一客户端可以是多媒体房间内的客户端,也可以是未参与多媒体房间的客户端;将接收业务服务器发送的增量消息的客户端称为第二客户端,第二客户端包括多媒体房间内的所有客户端或部分客户端。第一客户端和第二客户端可以是相同的设备,也可以是不同的设备,具体不做限定。
本公开中,第一客户端、业务服务器和第二客户端之间的交互过程可以包括如下步骤:在S101中,第一客户端获取针对多媒体房间的状态变更请求,将状态变更请求发送至业务服务器;在S102中,业务服务器根据状态变更请求,更新多媒体房间的第一房间信息;在S103中,业务服务器向第一客户端返回状态变更请求的请求结果;在S104中,第一客户端响应于接收到请求结果来执行状态变更请求对应的操作;在S105中,业务服务器生成第一房间信息的增量消息,通过长连接向多媒体房间内的第二客户端发送增量消息;在S106中,第二客户端根据增量消息,更新多媒体房间的第二房间信息。
在一些实施例中,多媒体房间可以是视频房间,也可以是语音房间,具体不做限定。状态变更请求可以是第一客户端通过与用户的交互,响应于用户的状态变更操作生成的,在一些实施例中,状态变更请求也可以是第一客户端从其他用户设备中获取的,或按照预设规则自动生成的。
在一些实施例中,针对多媒体房间的状态变更请求可以是对多媒体房间内的客户端列表的变更请求,比如,可以是任一客户端加入多媒体房间的请求(JoinRoom)。在一些实施例中,该变更请求可以是任一客户端从多媒体房间内离开的请求(LeaveRoom),该客户端可以是第一客户端,也可以是其他的客户端。在一些实施例中,该变更请求还可以是关闭多媒体房间的请求(CloseRoom),具体不做限定。
另外,在多媒体房间内,客户端可以划分为不同的角色,每个角色都具有不同的权限,举例而言,多媒体房间内的角色可以包括主持人(Host)、发言人(Speaker)、听众(Audience)和被关注人(FollowedBySpeakers)等等。其中,主持人具有发言、邀请观众发言、将其他主持人或发言人降级为听众等管理权限。发言人具有发言权限。听众没有发言权限,只能听发言人或主持人发言,但是具有举手要求发言的权限。被关注人即为被主持人和发言人关注的人,被关注人没有发言权限,只能听发言人或主持人发言,但是具有举手要求发 言的权限,在界面显示上与听众有区别。
如图1B所示,为多媒体房间内各角色的切换逻辑示意图。其中,听众可以举手发言,主持人从举手发言的听众中选择一个或多个听众邀请发言。在一些实施例中,主持人也可以直接选择任意一个或多个听众邀请发言,被邀请发言的听众经确认后即可成为发言人。发言人可以自己申请或被主持人切换为听众。主持人可以邀请发言人成为主持人,被邀请的发言人经确认后即可成为主持人。在一些实施例中,当任一主持人离开多媒体房间后,如果多媒体房间内没有其他主持人,则可以随机或按照发言顺序选择发言人成为主持人。另外,任一主持人可以将其他主持人切换为听众。在一些实施例中,在多媒体房间内有其他主持人的情况下,主持人可以自己切换为听众。
在一些实施例中,针对多媒体房间的状态变更请求也可以是任一客户端在多媒体房间内的角色的切换请求。比如,举手发言请求(RaiseHand)、取消举手发言请求(UnRaiseHand)、邀请发言请求(InviteToSpeaker)、接受发言邀请请求(AcceptToSpeaker)、拒绝发言邀请请求(RejectToSpeaker)、主持人邀请请求(InviteToHost)、接受主持人邀请请求(AcceptToHost)、拒绝主持人邀请请求(RejectToHost)、将发言人降为听众的请求(RemoveSpeaker)以及将主持人降为听众的请求(RemoveHost)。
在一些实施例中,针对多媒体房间的状态变更请求还可以是麦克风状态切换请求,比如,打开麦克风请求(OpenMic)和关闭麦克风请求(CloseMic)。
在S102中,业务服务器根据状态变更请求,更新多媒体房间的第一房间信息。
其中,第一房间信息为业务服务器本地存储的多媒体房间的房间信息。房间信息内可以包括多媒体房间内的客户端列表、每个客户端的角色信息以及多媒体房间的基本信息等。
举例而言,客户端列表可以包括如下一项或多项信息:被关注人列表(followedBySpeakers)、主持人列表(hosts)、听众列表(listeners)、发言人列表(speakers)。客户端列表中每个客户端的信息可以包括如下一项或多项信息:头像(avatar)、昵称(nickname)、id(userId)、麦克风状态信息(micOpen)以及角色信息,其中,角色信息包括当前角色信息(currentUserRegion)、举手状态信息(handRaise)以及发言邀请状态信息(invitedToSpeaker)。基本信息可以包括房间id(channelId)、房间标题(title)、实时通信房间标识(Real-time Communications Token)和视频云服务推流地址(Live Server push Stream Url)。
其中,实时通信房间标识用于从实时通信服务器(RTCServer)中查询该多媒体房间对应的实时通信房间。RTCServer用于提供实时通信收发服务,负责多媒体房间内的多媒体通信沟通以及将多媒体数据推流给视频云服务推流地址对应的视频云服务器(LiveServer)。LiveServer用于接受实时多媒体数据流,从而实现实时审核和旁路录制。
业务服务器根据状态变更请求,可以对所存储的多媒体房间的第一房间信息进行更新。
举例而言,响应于状态变更请求为第一客户端的加入房间请求,业务服务器可以将第一客户端添加至客户端列表中,实现对第一房间信息的更新;响应于状态变更请求为第一客户端的离开房间请求,业务服务器可以将第一客户端从客户端列表中删除,实现对第一房间信息的更新;响应于状态变更请求为关闭房间请求,业务服务器可以将第一客户端从客户端列表中删除,实现对第一房间信息的更新。
在一些实施例中,响应于状态变更请求为角色切换请求,业务服务器可以根据角色切换请求,更新第一客户端的角色信息。比如,角色切换请求可以为举手发言请求或取消举手发言请求,可以对应地更新第一客户端的举手状态信息;角色切换请求可以为邀请发言请求,可以对应地更新第一客户端的发言邀请状态信息;角色切换请求可以为主持人邀请请求,可以对应地更新第一客户端的主持人邀请状态信息;角色切换请求可以为接受发言 邀请请求、拒绝发言邀请请求、接受主持人邀请请求或拒绝主持人邀请请求,可以对应地更新第一客户端的当前角色信息;角色切换请求可以为将发言人降为听众的请求或将主持人降为听众的请求,可以对应地更新发言人或主持人的当前角色信息,等等。
另外,响应于状态变更请求为麦克风状态切换请求,业务服务器可以根据麦克风状态切换请求,更新第一客户端的麦克风状态信息。比如,麦克风状态切换请求可以为打开麦克风请求或关闭麦克风请求。
在一些实施例中,状态变更请求为创建房间请求,业务服务器可以根据创建房间请求,生成多媒体房间的基本信息,并向实时通信服务器请求实时通信服务信息,得到第一房间信息。
在S103中,业务服务器向第一客户端返回状态变更请求的请求结果。
响应于接收到状态变更请求,业务服务器可以向第一客户端返回状态变更请求的请求结果,请求结果用于只适合第一客户端发送的状态变更请求是否请求成功。
举例而言,响应于状态变更请求为创建房间请求,业务服务器返回的请求结果可以为创建房间确认信息,其中,在业务服务器创建多媒体房间之后,第一客户端不会自动加入所创建的多媒体房间,如果第一客户端需要加入该多媒体房间,可以进一步向业务服务器发送加入该多媒体房间的加入房间请求。
响应于状态变更请求为加入房间请求,业务服务器返回的请求结果可以为第一房间信息;响应于状态变更请求为离开房间请求,业务服务器返回的请求结果可以为离开房间确认信息;响应于状态变更请求为关闭房间请求,业务服务器返回的请求结果可以为离开房间确认信息;响应于状态变更请求为角色切换请求,业务服务器返回的请求结果可以为角色切换请求的请求结果;响应于状态变更请求为麦克风状态切换请求,业务服务器返回的请求结果可以为麦克风状态切换确认信息。
在S104中,第一客户端响应于接收到请求结果来执行状态变更请求对应的操作。
在本步骤中,根据状态变更请求以及接收到的请求结果的不同,第一客户端所执行的操作也有所不同。
举例而言,在状态变更请求为加入房间请求的情况下,响应于第一客户端接收到了业务服务器返回的第一房间信息,即表示加入多媒体房间的请求成功,第一客户端可以根据第一房间信息中的实时通信服务信息,与实时通信服务器建立连接,以使实时通信服务器提供多媒体数据的采集和推流服务;响应于第一客户端未接收到业务服务器返回的第一房间信息,即表示加入多媒体房间的请求失败,第一客户端可以重新向业务服务器发送加入房间请求,或提示用户更换多媒体房间,具体不做限定。
在状态变更请求为离开房间请求的情况下,响应于第一客户端接收到了业务服务器返回的离开房间确认信息,即表示离开多媒体房间的请求成功,第一客户端可以向实时通信服务器发送断开连接请求,以使实时通信服务器断开与第一客户端的连接;响应于第一客户端接收到了业务服务器返回的离开房间失败信息,即表示离开多媒体房间的请求失败,第一客户端可以重新向业务服务器发送离开房间请求,或提示用户离开多媒体房间失败,具体不做限定。
在状态变更请求为关闭房间请求的情况下,响应于第一客户端接收到业务服务器返回的离开房间确认信息,即表示关闭多媒体房间的请求成功,第一客户端可以向实时通信服务器发送断开连接请求,以使实时通信服务器断开与第一客户端的连接;响应于第一客户端接收到了业务服务器返回的离开房间失败信息,即表示关闭多媒体房间的请求失败,第一客户端可以重新向业务服务器发送关闭房间请求,或提示用户关闭多媒体房间失败,具体不做限定。
在状态变更请求为麦克风状态切换请求的情况下,响应于第一客户端接收到业务服务器返回的麦克风状态切换确认信息,即表示麦克风状态切换成功,第一客户端可以向实时 通信服务器发送实时通信服务请求,以使实时通信服务器开始或停止多媒体数据的采集和推流;响应于第一客户端接收到了业务服务器返回的麦克风状态切换失败信息,即表示麦克风状态切换的请求失败,第一客户端可以重新向业务服务器发送麦克风状态切换请求,或提示用户麦克风状态切换失败,具体不做限定。
在一些实施例中,状态变更请求为角色切换请求,不同的角色切换请求对应的操作也有所不同。举例而言,当第一客户端发送的角色切换请求为接受发言邀请请求时,响应于请求成功,第一客户端可以请求实时通信服务器的多媒体数据的采集和推流服务。
在S105中,业务服务器生成第一房间信息的增量消息,通过长连接向多媒体房间内的第二客户端发送增量消息。
其中,长连接是指可以连续发送多个数据包的连接,可以负责下行消息发送以及超时断开的通知。比如,可以是KwaiLink长连接。也就是说,业务服务器在第一房间信息有变化时,生成增量消息,进而通过长连接向第二客户端发送增量消息,如果第一房间信息没有发生变化,则业务服务器不发送增量消息。
这样,相比于相关技术中第二客户端定期向业务服务器发送数据获取请求的方式,可以节省资源,减少第二客户端不必要的向业务服务器发送的请求,降低业务服务器的处理压力。
增量消息是指用于指示第一房间信息的增量变化的消息,也就是说,根据增量消息,可以确定多媒体房间的房间信息发生了哪些变化,进而使得接收到增量消息的设备可以对自身存储的多媒体房间的房间信息进行更新,更新后的房间信息与业务服务器中存储的同一多媒体房间的房间信息同步。
在一些实施例中,业务服务器可以根据上一条增量消息的版本号,确定当前生成的增量消息的版本号,进而,通过长连接向多媒体房间内的第二客户端发送当前生成的增量消息及对应的版本号,这样,第二客户端在接收到的增量消息的版本号大于第二房间信息的版本号的情况下,对接收到的增量消息进行处理,并将接收到的增量消息的版本号作为更新后的第二房间信息的版本号。
其中,增量消息的版本号可以表示为roomVersion,增量消息的版本号可以是纯数字的形式,比如,在上一条增量消息的版本号的基础上加一,得到新的版本号。在一些实施例中,也可以按照预设的规则对上一条增量消息的版本号进行处理,计算得到新的版本号,具体不做限定。
这样,在业务服务器与第二客户端之间的长连接存在网络延迟的情况下,第二客户端根据增量消息的版本号对最新的增量消息进行处理,可以减少前后两条增量消息接收顺序导致乱序的可能性。
在S106中,第二客户端根据增量消息,更新多媒体房间的第二房间信息。
其中,第二房间信息为第二客户端本地存储的多媒体房间的房间信息。第二房间信息中可以包括第一房间信息的全部信息,也可以仅包括第一房间信息中的部分信息,也可以根据第二客户端对应的角色的不同,包括第一房间信息中的不同信息,具体不做限定。
在一些实施例中,第二客户端在更新多媒体房间的第二房间信息后,可以根据更新后的第二房间信息执行相应的操作。举例而言,响应于第二房间信息中更新了举手发言列表,第二客户端可以从举手发言列表中选择第一客户端,向业务服务器发送针对被选择的第一客户端的邀请发言请求。
在一些实施例中,第二客户端可以按照第一时间间隔,向业务服务器发送心跳消息,用于通知业务服务器第二客户端的在线状态,这样,业务服务器如果接收到心跳消息,就可以判定发送心跳消息的第二客户端目前为在线状态,而在第二时间间隔内未接收到任一第二客户端的心跳消息的情况下,业务服务器可以判定该第二客户端离开多媒体房间,进而可以更新第一房间信息中的客户端列表,执行生成第一房间信息的增量消息的步骤。
其中,第一时间间隔也就是心跳发送间隔时间(heartbeatIntervalMs),可以是业务服务器全局预设的时间,也可以包括在多媒体房间的房间信息中,根据不同的多媒体房间进行设定。第二时间间隔不小于第一时间间隔,可以是预设的时间,也可以是根据第一时间间隔确定的时间,具体不做限定。
这样,在任一第二客户端离开多媒体房间的情况下,业务服务器可以及时对客户端列表进行更新,在下发增量消息时,减少增量消息发送的次数,进一步降低业务服务器的处理压力。
在一些实施例中,第二客户端还可以按照第三时间间隔,检测与业务服务器之间的长连接,在长连接断开的情况下,重新与业务服务器建立长连接。其中,第三时间间隔可以与第一时间间隔相同,比如,第二客户端可以利用向业务服务器发送心跳消息的机会,检测与业务服务器之间的长连接,在一些实施例中,第三时间间隔也可以与第一时间间隔不同,比如,第二客户端也可以单独向业务服务器发送长连接检测请求,具体不做限定。这样,可以在长连接断开的情况下及时恢复连接,从而增强长连接的稳定性。
另外,第二客户端还可以按照第四时间间隔,向业务服务器发送房间信息获取请求,业务服务器在接收到房间信息获取请求后,向第二客户端返回第一房间信息,第二客户端将接收到的第一房间信息存储为新的第二房间信息。
也就是说,第二客户端可以定期向业务服务器拉取多媒体房间的全量房间信息,在本公开中,第四时间间隔比较长,可以表示为syncFullIntervalMs。通常,第四时间间隔大于5分钟,这样既能保证第二客户端中第二房间信息的准确性,又不会增加业务服务器的处理压力。
在一些实施例中,在业务服务器与第二客户端之间的长连接断开的情况下,第二客户端可以发送增量消息获取请求,增量消息获取请求携带第二房间信息的版本号,业务服务器在任一增量消息的版本号大于增量消息获取请求携带的版本号的情况下,向第二客户端返回该增量消息,或者,在增量消息的版本号均不大于增量消息获取请求携带的版本号的情况下,在第五时间间隔之后,向第二客户端返回增量消息获取结果。
也就是说,业务服务器接收到增量消息获取请求后,不立即返回增量消息获取结果,直到第一房间信息发生变化,产生了新的增量消息的版本号,或者直到第五时间间隔之后,才向第二客户端返回增量消息获取结果。其中,第五时间间隔是一段较长的时间,可以是1分钟。这样,在业务服务器与第二客户端之间的长连接断开的情况下,既能减少业务服务器频繁返回数据造成的请求压力,也能实现房间数据的实时性和准确性。
在本公开中,每个客户端的角色变化情况可以包括但不限于如下几种:
第一种,从听众变为发言人:听众客户端向业务服务器发送举手发言请求,业务服务器更新第一房间信息后,通过长连接将增量消息下发消息给主持人客户端,主持人客户端发送邀请发言请求到业务服务器,业务服务器再通过长连接下发增量消息给听众客户端,听众客户端向业务服务器发送接受邀请的请求,请求成功后请求RTCServer开始录音和推流,同时业务服务器还通过长连接下发增量消息给其他客户端,更新听众角色的变化。在一些实施例中,也可以由主持人客户端直接发送邀请发言请求到业务服务器,具体不做限定;
第二种,从发言人变为主持人:主持人客户端发送针对发言人客户端的邀请成为主持人请求到业务服务器,业务服务器通过长连接下发增量消息给发言人客户端,发言人客户端向业务服务器发送接受邀请的请求,业务服务器通过长连接下发增量消息给其他客户端更新发言人客户端角色的变化;
第三种,从主持人变为听众:主持人客户端发送将任一客户端降为听众的请求到业务服务器,业务服务器更新第一房间信息后,再通过长连接下发增量消息给第二客户端更新该客户端角色的变化;
第四种,从发言人变为听众:在一种情况下,发言人客户端发送将自己降为听众的请求到业务服务器,业务服务器更新第一房间信息后再通过长连接下发增量消息给其他客户端更新发言人客户端角色的变化;在另一种情况下,主持人客户端发送将发言人客户端降为听众的请求到业务服务器,业务服务器更新第一房间信息后再通知长连接下发增量消息给其他客户端,更新发言人客户端角色的变化。
由以上可见,本公开实施例提供的技术方案中,业务服务器在更新第一房间信息之后,可以通过生成并向多媒体房间内的第二客户端发送增量消息,就可以实现第二客户端与业务服务器中存储的多媒体房间的房间信息的同步,第二客户端可以减少向业务服务器发送信息获取请求的次数,也减少了业务服务器接收到的信息获取请求的数量,从而减轻了业务服务器的负载压力。
如图2所示,本公开实施例提供的一种应用于第一客户端的信息同步方法包括如下步骤:在S201中,获取针对多媒体房间的状态变更请求,将状态变更请求发送至业务服务器;在S202中,响应于接收到请求结果,执行状态变更请求对应的操作。
响应于获取针对多媒体房间的状态变更请求,业务服务器可以向第一客户端返回状态变更请求的请求结果,并通过长连接向多媒体房间内的第二客户端发送第一房间信息的增量消息。
第二客户端可以根据增量消息更新第二房间信息。其中,第一房间信息为业务服务器本地存储的多媒体房间的房间信息,第二客户端为多媒体房间内除第一客户端之外的其他客户端,第二房间信息为第二客户端本地存储的多媒体房间的房间信息。
在S202中,响应于接收到请求结果,执行状态变更请求对应的操作。
在一些实施例中,在状态变更请求为加入房间请求的情况下,业务服务器可以根据加入房间请求,将第一客户端添加至客户端列表中,向第一客户端返回第一房间信息。其中,第一房间信息中包括多媒体房间内的客户端列表及实时通信服务信息。这样,第一客户端可以根据实时通信服务信息,与实时通信服务器建立连接,以使实时通信服务器提供多媒体数据的采集和推流服务。
在一些实施例中,在状态变更请求为离开房间请求的情况下,业务服务器可以根据离开房间请求,将第一客户端从客户端列表中删除,向第一客户端返回离开房间确认信息。这样,第一客户端可以响应于接收到离开房间确认信息来向实时通信服务器发送断开连接请求,以使实时通信服务器断开与第一客户端的连接。
在一些实施例中,在状态变更请求为关闭房间请求的情况下,业务服务器可以将第一客户端从客户端列表中删除,向第一客户端返回离开房间确认信息。这样,第一客户端可以响应于接收到离开房间确认信息来向实时通信服务器发送断开连接请求,以使实时通信服务器断开与第一客户端的连接。
在一些实施例中,在状态变更请求为麦克风状态切换请求的情况下,业务服务器可以根据麦克风状态切换请求更新第一客户端的麦克风状态信息,向第一客户端返回麦克风状态切换确认信息。这样,第一客户端可以响应于接收到麦克风状态切换确认信息来向实时通信服务器发送实时通信服务请求,以使实时通信服务器开始或停止多媒体数据的采集和推流。
由以上可见,本公开实施例提供的技术方案中,响应于更新第一房间信息,业务服务器可以通过生成并向多媒体房间内的第二客户端发送增量消息,就可以实现第二客户端与业务服务器中存储的多媒体房间的房间信息的同步,第二客户端可以减少向业务服务器发送信息获取请求的次数,也减少了业务服务器接收到的信息获取请求的数量,从而减轻了业务服务器的负载压力。
如图3所示,本公开实施例提供的一种应用于业务服务器的信息同步方法包括如下步骤:在S301中,接收第一客户端发送的针对多媒体房间的状态变更请求;在S302中,根 据状态变更请求,更新多媒体房间的第一房间信息,第一房间信息为业务服务器本地存储的多媒体房间的房间信息;在S303中,向第一客户端返回状态变更请求的请求结果,并生成第一房间信息的增量消息,通过长连接向多媒体房间内的第二客户端发送增量消息,第二客户端为多媒体房间内除第一客户端之外的其他客户端。
在一些实施例中,在状态变更请求为创建房间请求的情况下,业务服务器可以根据创建房间请求,生成多媒体房间的基本信息,并向实时通信服务器请求实时通信服务信息,得到第一房间信息,并向第一客户端返回创建房间确认信息。
在一些实施例中,在状态变更请求为加入房间请求的情况下,第一房间信息中还包括多媒体房间内的客户端列表,业务服务器可以根据加入房间请求,将第一客户端添加至客户端列表中,向第一客户端返回第一房间信息,以使第一客户端根据实时通信服务信息与实时通信服务器建立连接,以使实时通信服务器提供多媒体数据的采集和推流服务。
在一些实施例中,在状态变更请求为离开房间请求的情况下,业务服务器可以根据离开房间请求,将第一客户端从客户端列表中删除,向第一客户端返回离开房间确认信息,以使第一客户端向实时通信服务器发送断开连接请求,以使实时通信服务器断开与第一客户端的连接。
在一些实施例中,在状态变更请求为关闭房间请求的情况下,业务服务器可以将第一客户端从客户端列表中删除,向第一客户端返回离开房间确认信息,以使第一客户端向实时通信服务器发送断开连接请求,以使实时通信服务器断开与第一客户端的连接。
在一些实施例中,在状态变更请求为角色切换请求,第一房间信息中还包括多媒体房间内每个客户端的角色信息的情况下,业务服务器可以根据角色切换请求,更新第一客户端的角色信息,向第一客户端返回角色切换请求的请求结果;进一步地,业务服务器可以仅向角色切换请求对应的第二客户端发送增量消息。
在一些实施例中,在状态变更请求为麦克风状态切换请求,第一房间信息中还包括多媒体房间内每个客户端的麦克风状态信息的情况下,业务服务器可以根据麦克风状态切换请求,更新第一客户端的麦克风状态信息,向第一客户端返回麦克风状态切换确认信息,以使第一客户端向实时通信服务器发送实时通信服务请求,以使实时通信服务器开始或停止多媒体数据的采集和推流。
在S303中,向第一客户端返回状态变更请求的请求结果,并生成第一房间信息的增量消息,通过长连接向多媒体房间内的第二客户端发送增量消息,第二客户端为多媒体房间内除第一客户端之外的其他客户端。
在一些实施例中,业务服务器可以根据上一条增量消息的版本号,确定当前生成的增量消息的版本号,进而,通过长连接向多媒体房间内的第二客户端发送当前生成的增量消息及对应的版本号,这样,第二客户端在接收到的增量消息的版本号大于第二房间信息的版本号的情况下,对接收到的增量消息进行处理,并将接收到的增量消息的版本号作为更新后的第二房间信息的版本号。
其中,增量消息的版本号可以表示为roomVersion,增量消息的版本号可以是纯数字的形式,比如,在上一条增量消息的版本号的基础上加一,得到新的版本号,在一些实施例中,也可以按照预设的规则对上一条增量消息的版本号进行处理,计算得到新的版本号,具体不做限定。
这样,在业务服务器与第二客户端之间的长连接存在网络延迟的情况下,第二客户端根据增量消息的版本号对最新的增量消息进行处理,可以减少前后两条增量消息接收顺序导致乱序的可能性。
在一些实施例中,第二客户端可以按照第一时间间隔,向业务服务器发送心跳消息,用于通知业务服务器第二客户端的在线状态,这样,业务服务器如果接收到心跳消息,就可以判定发送心跳消息的第二客户端目前为在线状态,而在第二时间间隔内未接收到任一 第二客户端的心跳消息的情况下,业务服务器可以判定该第二客户端离开多媒体房间,进而可以更新第一房间信息中的客户端列表,执行生成第一房间信息的增量消息的步骤。
其中,第一时间间隔也就是心跳发送间隔时间(heartbeatIntervalMs),可以是业务服务器全局预设的时间,也可以包括在多媒体房间的房间信息中,根据不同的多媒体房间进行设定。第二时间间隔不小于第一时间间隔,可以是预设的时间,也可以是根据第一时间间隔确定的时间,具体不做限定。
这样,在任一第二客户端离开多媒体房间的情况下,业务服务器可以及时对客户端列表进行更新,在下发增量消息时,减少增量消息发送的次数,进一步降低业务服务器的处理压力。
在一些实施例中,第二客户端还可以按照第三时间间隔,检测与业务服务器之间的长连接,在长连接断开的情况下,重新与业务服务器建立长连接。其中,第三时间间隔可以与第一时间间隔相同,比如,第二客户端可以利用向业务服务器发送心跳消息的机会,检测与业务服务器之间的长连接,在一些实施例中,第三时间间隔也可以与第一时间间隔不同,比如,第二客户端也可以单独向业务服务器发送长连接检测请求,具体不做限定。这样,可以在长连接断开的情况下及时恢复连接,从而增强长连接的稳定性。
另外,第二客户端还可以按照第四时间间隔,向业务服务器发送房间信息获取请求,业务服务器在接收到房间信息获取请求后,向第二客户端返回第一房间信息,第二客户端将接收到的第一房间信息存储为新的第二房间信息。
也就是说,第二客户端可以定期向业务服务器拉取多媒体房间的全量房间信息,在本公开中,第四时间间隔比较长,可以表示为syncFullIntervalMs,通常,第四时间间隔大于5分钟,这样既能保证第二客户端中第二房间信息的准确性,又不会增加业务服务器的处理压力。
在一些实施例中,在业务服务器与第二客户端之间的长连接断开的情况下,第二客户端可以发送增量消息获取请求,增量消息获取请求携带第二房间信息的版本号,业务服务器在任一增量消息的版本号大于增量消息获取请求携带的版本号的情况下,向第二客户端返回该增量消息,或,在增量消息的版本号均不大于增量消息获取请求携带的版本号的情况下,在第五时间间隔之后,向第二客户端返回增量消息获取结果。
也就是说,业务服务器接收到增量消息获取请求后,不立即返回增量消息获取结果,直到第一房间信息发生变化,产生了新的增量消息的版本号,或者直到第五时间间隔之后,才向第二客户端返回增量消息获取结果。其中,第五时间间隔是一段较长的时间,可以是1分钟。这样,在业务服务器与第二客户端之间的长连接断开的情况下,既能减少业务服务器频繁返回数据造成的请求压力,也能实现房间数据的实时性和准确性。
由以上可见,本公开实施例提供的技术方案中,响应于更新第一房间信息,业务服务器可以通过生成并向多媒体房间内的第二客户端发送增量消息,就可以实现第二客户端与业务服务器中存储的多媒体房间的房间信息的同步,第二客户端可以减少向业务服务器发送信息获取请求的次数,也减少了业务服务器接收到的信息获取请求的数量,从而减轻了业务服务器的负载压力。
如图4所示,本公开实施例提供的一种应用于第二客户端的信息同步方法包括如下步骤:在S401中,接收业务服务器通过长连接发送的第一房间信息的增量消息;在S402中,根据增量消息,更新多媒体房间的第二房间信息,第二房间信息为第二客户端本地存储的多媒体房间的房间信息。
其中,第一房间信息为业务服务器本地存储的多媒体房间的房间信息,增量消息为业务服务器根据第一客户端发送的状态变更请求更新多媒体房间的第一房间信息后生成的。
其中,长连接是指可以连续发送多个数据包的连接,可以负责下行消息发送以及超时断开的通知,比如,可以是KwaiLink长连接。也就是说,业务服务器在第一房间信息有 变化时,生成增量消息,进而通过长连接向第二客户端发送增量消息,如果第一房间信息没有发生变化,则业务服务器不发送增量消息。
这样,相比于相关技术中第二客户端定期向业务服务器发送数据获取请求的方式,可以节省资源,减少第二客户端不必要的向业务服务器发送的请求,降低业务服务器的处理压力。
增量消息是指用于指示第一房间信息的增量变化的消息,也就是说,根据增量消息,可以确定多媒体房间的房间信息发生了哪些变化,进而使得接收到增量消息的设备可以对自身存储的多媒体房间的房间信息进行更新,更新后的房间信息与业务服务器中存储的同一多媒体房间的房间信息同步。
在S402中,响应于更新多媒体房间的第二房间信息,第二客户端可以根据更新后的第二房间信息执行相应的操作。举例而言,响应于第二房间信息中更新了举手发言列表,第二客户端可以从举手发言列表中选择第一客户端,向业务服务器发送针对被选择的第一客户端的邀请发言请求。
在一些实施例中,业务服务器可以根据上一条增量消息的版本号,确定当前生成的增量消息的版本号,进而,通过长连接向多媒体房间内的第二客户端发送当前生成的增量消息及对应的版本号,这样,第二客户端在接收到的增量消息的版本号大于第二房间信息的版本号的情况下,对接收到的增量消息进行处理,并将接收到的增量消息的版本号作为更新后的第二房间信息的版本号。
其中,增量消息的版本号可以表示为roomVersion,增量消息的版本号可以是纯数字的形式,比如,在上一条增量消息的版本号的基础上加一,得到新的版本号,在一些实施例中,也可以按照预设的规则对上一条增量消息的版本号进行处理,计算得到新的版本号,具体不做限定。
这样,在业务服务器与第二客户端之间的长连接存在网络延迟的情况下,第二客户端根据增量消息的版本号对最新的增量消息进行处理,可以减少前后两条增量消息接收顺序导致乱序的可能性。
在一些实施例中,第二客户端可以按照第一时间间隔,向业务服务器发送心跳消息,用于通知业务服务器第二客户端的在线状态,这样,业务服务器如果接收到心跳消息,就可以判定发送心跳消息的第二客户端目前为在线状态,而在第二时间间隔内未接收到任一第二客户端的心跳消息的情况下,业务服务器可以判定该第二客户端离开多媒体房间,进而可以更新第一房间信息中的客户端列表,执行生成第一房间信息的增量消息的步骤。
其中,第一时间间隔也就是心跳发送间隔时间(heartbeatIntervalMs),可以是业务服务器全局预设的时间,也可以包括在多媒体房间的房间信息中,根据不同的多媒体房间进行设定。第二时间间隔不小于第一时间间隔,可以是预设的时间,也可以是根据第一时间间隔确定的时间,具体不做限定。
这样,在任一第二客户端离开多媒体房间的情况下,业务服务器可以及时对客户端列表进行更新,在下发增量消息时,减少增量消息发送的次数,进一步降低业务服务器的处理压力。
在一些实施例中,第二客户端还可以按照第三时间间隔,检测与业务服务器之间的长连接,在长连接断开的情况下,重新与业务服务器建立长连接。其中,第三时间间隔可以与第一时间间隔相同,比如,第二客户端可以利用向业务服务器发送心跳消息的机会,检测与业务服务器之间的长连接,在一些实施例中,第三时间间隔也可以与第一时间间隔不同,比如,第二客户端也可以单独向业务服务器发送长连接检测请求,具体不做限定。这样,可以在长连接断开的情况下及时恢复连接,从而增强长连接的稳定性。
另外,第二客户端还可以按照第四时间间隔,向业务服务器发送房间信息获取请求,业务服务器在接收到房间信息获取请求后,向第二客户端返回第一房间信息,第二客户端 将接收到的第一房间信息存储为新的第二房间信息。
也就是说,第二客户端可以定期向业务服务器拉取多媒体房间的全量房间信息,在本公开中,第四时间间隔比较长,可以表示为syncFullIntervalMs。通常,第四时间间隔大于5分钟,这样既能保证第二客户端中第二房间信息的准确性,又不会增加业务服务器的处理压力。
在一些实施例中,在业务服务器与第二客户端之间的长连接断开的情况下,第二客户端可以发送增量消息获取请求,增量消息获取请求携带第二房间信息的版本号,业务服务器在任一增量消息的版本号大于增量消息获取请求携带的版本号的情况下,向第二客户端返回该增量消息,或,在增量消息的版本号均不大于增量消息获取请求携带的版本号的情况下,在第五时间间隔之后,向第二客户端返回增量消息获取结果。
也就是说,业务服务器接收到增量消息获取请求后,不立即返回增量消息获取结果,直到第一房间信息发生变化,产生了新的增量消息的版本号,或者直到第五时间间隔之后,才向第二客户端返回增量消息获取结果。其中,第五时间间隔是一段较长的时间,可以是1分钟。这样,在业务服务器与第二客户端之间的长连接断开的情况下,既能减少业务服务器频繁返回数据造成的请求压力,也能实现房间数据的实时性和准确性。
由以上可见,本公开实施例提供的技术方案中,业务服务器响应于第一房间信息被更新,可以通过生成并向多媒体房间内的第二客户端发送增量消息,就可以实现第二客户端与业务服务器中存储的多媒体房间的房间信息的同步,第二客户端可以减少向业务服务器发送信息获取请求的次数,也减少了业务服务器接收到的信息获取请求的数量,从而减轻了业务服务器的负载压力。
如图5所示,本公开实施例提供的一种应用于第一客户端的信息同步装置包括获取单元501和第一接收单元502。
获取单元501被配置为获取针对多媒体房间的状态变更请求,将所述状态变更请求发送至业务服务器,以使所述业务服务器向所述第一客户端返回所述状态变更请求的请求结果,并通过长连接向所述多媒体房间内的第二客户端发送第一房间信息的增量消息,并使第二客户端根据所述增量消息更新第二房间信息,所述第一房间信息为所述业务服务器本地存储的所述多媒体房间的房间信息,所述第二房间信息为所述第二客户端本地存储的所述多媒体房间的房间信息。
第一接收单元502被配置为响应于接收到所述请求结果,执行所述状态变更请求对应的操作。
由以上可见,本公开实施例提供的技术方案中,业务服务器响应于第一房间信息被更新,可以通过生成并向多媒体房间内的第二客户端发送增量消息,就可以实现第二客户端与业务服务器中存储的多媒体房间的房间信息的同步,第二客户端可以减少向业务服务器发送信息获取请求的次数,也减少了业务服务器接收到的信息获取请求的数量,从而减轻了业务服务器的负载压力。
如图6所示,本公开实施例提供的一种应用于业务服务器的信息同步装置包括第二接收单元601、第一更新单元602和发送单元603。
第二接收单元601被配置为接收第一客户端发送的针对多媒体房间的状态变更请求。
第一更新单元602被配置为根据所述状态变更请求,更新所述多媒体房间的第一房间信息,所述第一房间信息为所述业务服务器本地存储的所述多媒体房间的房间信息。
发送单元603被配置为向所述第一客户端返回所述状态变更请求的请求结果,并生成所述第一房间信息的增量消息,通过长连接向所述多媒体房间内的第二客户端发送所述增量消息。
由以上可见,本公开实施例提供的技术方案中,业务服务器响应于第一房间信息被更新,可以通过生成并向多媒体房间内的第二客户端发送增量消息,就可以实现第二客户端 与业务服务器中存储的多媒体房间的房间信息的同步,第二客户端可以减少向业务服务器发送信息获取请求的次数,也减少了业务服务器接收到的信息获取请求的数量,从而减轻了业务服务器的负载压力。
如图7所示,本公开实施例提供的一种应用于第二客户端的信息同步装置包括第三接收单元701和第二更新单元702。
第三接收单元701被配置为接收业务服务器通过长连接发送的第一房间信息的增量消息,所述第一房间信息为所述业务服务器本地存储的所述多媒体房间的房间信息,所述增量消息为所述业务服务器根据第一客户端发送的状态变更请求更新所述多媒体房间的第一房间信息后生成的;
第二更新单元702被配置为根据所述增量消息,更新所述多媒体房间的第二房间信息,所述第二房间信息为所述第二客户端本地存储的所述多媒体房间的房间信息。
由以上可见,本公开实施例提供的技术方案中,业务服务器响应于第一房间信息被更新,可以通过生成并向多媒体房间内的第二客户端发送增量消息,就可以实现第二客户端与业务服务器中存储的多媒体房间的房间信息的同步,第二客户端可以减少向业务服务器发送信息获取请求的次数,也减少了业务服务器接收到的信息获取请求的数量,从而减轻了业务服务器的负载压力。
图8是根据一示例性实施例示出的另一种装置800的框图。例如,装置800可以是移动电话,计算机,数字广播电子设备,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。
参照图10,装置800可以包括以下一个或多个组件:处理组件802,存储器804,电力组件806,多媒体组件808,音频组件810,输入/输出(I/O)的接口812,传感器组件814,以及通信组件816。
处理组件802通常控制装置800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。
存储器804被配置为存储各种类型的数据以支持在设备800的操作。这些数据的示例包括用于在装置800上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。
电源组件807为装置800的各种组件提供电力。电源组件807可以包括电源管理系统,一个或多个电源,及其他与为装置800生成、管理和分配电力相关联的组件。
多媒体组件808包括在所述装置800和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件808包括一个前置摄像头和/或后置摄像头。当设备800处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。
音频组件810被配置为输出和/或输入音频信号。例如,音频组件810包括一个麦克风(MIC),当装置800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克 风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器404或经由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。
I/O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。
传感器组件814包括一个或多个传感器,用于为装置800提供各个方面的状态评估。例如,传感器组件814可以检测到设备800的打开/关闭状态,组件的相对定位,例如所述组件为装置800的显示器和小键盘,传感器组件814还可以检测装置800或装置800一个组件的位置改变,用户与装置800接触的存在或不存在,装置800方位或加速/减速和装置800的温度变化。传感器组件814可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件814还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件814还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。
通信组件816被配置为便于装置800和其他设备之间有线或无线方式的通信。装置800可以接入基于通信标准的无线网络,如WiFi,运营商网络(如2G、3G、4G或5G),或它们的组合。在一个示例性实施例中,通信组件416经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件816还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。
在示例性实施例中,装置800可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述任一信息同步方法。
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器804,上述指令可由装置800的处理器820执行以完成上述方法。在一些实施例中,例如,存储介质可以是非临时性计算机可读存储介质,例如,所述非临时性非临时性计算机可读存储介质计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。
如图9所示,本公开实施例提供的一种电子设备的结构示意图。
在示例性实施例中,还提供了一种包括指令的计算机可读存储介质,例如包括指令的存储器,上述指令可由电子设备的处理器执行以完成上述方法。在一些实施例中,计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。
在示例性实施例中,还提供一种计算机程序产品,当其在计算机上运行时,使得计算机实现上述多媒体数据播放的方法。
本公开还提供了一种存储介质,当所述存储介质中的指令由电子设备的处理器执行时,使得所述电子设备能够执行上述任一信息同步方法。
本公开还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机实现上述任一信息同步方法。
由以上可见,本公开实施例提供的技术方案中,业务服务器响应于第一房间信息被更新,可以通过生成并向多媒体房间内的第二客户端发送增量消息,就可以实现第二客户端与业务服务器中存储的多媒体房间的房间信息的同步,第二客户端可以减少向业务服务器发送信息获取请求的次数,也减少了业务服务器接收到的信息获取请求的数量,从而减轻 了业务服务器的负载压力。
本公开所有实施例均可以单独被执行,也可以于其他实施例相结合被执行,均视为本公开要求的保护范围。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,该计算机程序可存储于一计算机可读取存储介质中,该计算机程序在执行时,可以包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可以包括非易失性和/或易失性存储器。

Claims (42)

  1. 一种信息同步系统,包括:
    第一客户端,用于获取针对多媒体房间的状态变更请求,将所述状态变更请求发送至业务服务器;
    所述业务服务器,用于根据所述状态变更请求,更新所述多媒体房间的第一房间信息,向所述第一客户端返回所述状态变更请求的请求结果,并生成所述第一房间信息的增量消息,通过长连接向所述多媒体房间内的第二客户端发送所述增量消息,所述第一房间信息为所述业务服务器本地存储的所述多媒体房间的房间信息;
    其中,所述第一客户端还用于响应于接收到所述请求结果,执行所述状态变更请求对应的操作;
    其中,所述第二客户端用于根据所述增量消息,更新所述多媒体房间的第二房间信息,所述第二房间信息为所述第二客户端本地存储的所述多媒体房间的房间信息。
  2. 根据权利要求1所述的系统,其中,
    所述业务服务器用于根据上一条增量消息的版本号,确定当前生成的增量消息的版本号,通过长连接向所述多媒体房间内的第二客户端发送当前生成的增量消息及对应的版本号;
    所述第二客户端用于响应于接收到的增量消息的版本号大于所述第二房间信息的版本号,根据接收到的增量消息,更新所述第二房间信息,并将接收到的增量消息的版本号作为更新后的所述第二房间信息的版本号。
  3. 根据权利要求1所述的系统,其中,
    所述第二客户端还用于按照第一时间间隔,向所述业务服务器发送心跳消息;
    所述业务服务器还用于响应于在第二时间间隔内未接收到任一所述第二客户端的心跳消息,判定该第二客户端离开所述多媒体房间,更新所述第一房间信息中的客户端列表,执行所述生成所述第一房间信息的增量消息的步骤。
  4. 根据权利要求1所述的系统,其中,
    所述第二客户端还用于按照第三时间间隔,检测与所述业务服务器之间的长连接,并且响应于检测到所述长连接断开,重新与所述业务服务器建立长连接。
  5. 根据权利要求1所述的系统,其中,
    所述第二客户端还用于按照第四时间间隔,向所述业务服务器发送房间信息获取请求;
    所述业务服务器还用于在接收到所述房间信息获取请求后,向所述第二客户端返回所述第一房间信息;
    所述第二客户端还用于将接收到的第一房间信息存储为新的第二房间信息。
  6. 根据权利要求1所述的系统,其中,响应于所述业务服务器与所述第二客户端之间的长连接断开,
    所述第二客户端还用于发送增量消息获取请求,所述增量消息获取请求携带所述第二房间信息的版本号;
    所述业务服务器还用于响应于任一增量消息的版本号大于所述增量消息获取请求携带的版本号,向所述第二客户端返回该增量消息;或,响应于增量消息的版本号均不大于所述增量消息获取请求携带的版本号,在第五时间间隔之后,向所述第二客户端返回增量消息获取结果。
  7. 根据权利要求1所述的系统,其中,
    所述第二客户端还用于在更新所述多媒体房间的第二房间信息后,根据更新后的第二房间信息执行相应的操作。
  8. 根据权利要求1所述的系统,其中,所述状态变更请求为创建房间请求;
    所述业务服务器用于根据所述创建房间请求,生成多媒体房间的基本信息,并向实时通信服务器请求实时通信服务信息,得到第一房间信息,并向所述第一客户端返回创建房间确认信息。
  9. 根据权利要求8所述的系统,其中,所述状态变更请求为加入房间请求,所述第一房间信息中还包括所述多媒体房间内的客户端列表;
    所述业务服务器用于根据所述加入房间请求,将所述第一客户端添加至所述客户端列表中,向所述第一客户端返回所述第一房间信息;
    所述第一客户端用于根据所述实时通信服务信息,与实时通信服务器建立连接,以使所述实时通信服务器提供多媒体数据的采集和推流服务。
  10. 根据权利要求9所述的系统,其中,所述状态变更请求为离开房间请求;
    所述业务服务器用于根据所述离开房间请求,将所述第一客户端从所述客户端列表中删除,向所述第一客户端返回离开房间确认信息;
    所述第一客户端用于响应于接收到所述离开房间确认信息,向所述实时通信服务器发送断开连接请求,以使所述实时通信服务器断开与所述第一客户端的连接。
  11. 根据权利要求10所述的系统,其中,所述状态变更请求为关闭房间请求;
    所述业务服务器用于将所述第一客户端从所述客户端列表中删除,向所述第一客户端返回离开房间确认信息;
    所述第一客户端用于响应于接收到所述离开房间确认信息,向所述实时通信服务器发送断开连接请求,以使所述实时通信服务器断开与所述第一客户端的连接。
  12. 根据权利要求1所述的系统,其中,所述状态变更请求为角色切换请求,所述第一房间信息中还包括所述多媒体房间内每个客户端的角色信息;
    所述业务服务器用于根据所述角色切换请求,更新所述第一客户端的角色信息,向所述第一客户端返回所述角色切换请求的请求结果,并生成所述第一房间信息的增量消息,通过长连接向所述角色切换请求对应的第二客户端发送所述增量消息。
  13. 根据权利要求1所述的系统,其中,所述状态变更请求为麦克风状态切换请求,所述第一房间信息中还包括所述多媒体房间内每个客户端的麦克风状态信息:
    所述业务服务器用于根据所述麦克风状态切换请求,更新所述第一客户端的麦克风状态信息,向所述第一客户端返回麦克风状态切换确认信息;
    所述第一客户端用于响应于接收到所述麦克风状态切换确认信息,向实时通信服务器发送实时通信服务请求,以使所述实时通信服务器开始或停止多媒体数据的采集和推流。
  14. 一种信息同步方法,应用于第一客户端,所述方法包括:
    获取针对多媒体房间的状态变更请求,
    将所述状态变更请求发送至业务服务器,以使所述业务服务器向所述第一客户端返回所述状态变更请求的请求结果,并通过长连接向所述多媒体房间内的第二客户端发送第一房间信息的增量消息,并使第二客户端根据所述增量消息更新第二房间信息,
    所述第一房间信息为所述业务服务器本地存储的所述多媒体房间的房间信息,所述第二房间信息为所述第二客户端本地存储的所述多媒体房间的房间信息;
    响应于接收到所述请求结果,执行所述状态变更请求对应的操作。
  15. 根据权利要求14所述的方法,其中,响应于所述状态变更请求为加入房间请求,所述业务服务器根据所述加入房间请求,将所述第一客户端添加至所述客户端列表中,向所述第一客户端返回所述第一房间信息,所述第一房间信息中包括所述多媒体房间内的客户端列表及实时通信服务信息;
    其中,响应于接收到所述请求结果,执行所述状态变更请求对应的操作,包括:
    根据所述实时通信服务信息,与实时通信服务器建立连接,以使所述实时通信服务器提供多媒体数据的采集和推流服务。
  16. 根据权利要求14所述的方法,其中,响应于所述状态变更请求为离开房间请求,所述业务服务器根据所述离开房间请求,将所述第一客户端从所述客户端列表中删除,向所述第一客户端返回离开房间确认信息;
    其中,响应于接收到所述请求结果,执行所述状态变更请求对应的操作,包括:
    响应于接收到所述离开房间确认信息,向所述实时通信服务器发送断开连接请求,以使所述实时通信服务器断开与所述第一客户端的连接。
  17. 根据权利要求16所述的方法,其中,响应于所述状态变更请求为关闭房间请求,所述业务服务器将所述第一客户端从所述客户端列表中删除,向所述第一客户端返回离开房间确认信息;
    其中,响应于接收到所述请求结果,执行所述状态变更请求对应的操作,包括:
    响应于接收到所述离开房间确认信息,向所述实时通信服务器发送断开连接请求,以使所述实时通信服务器断开与所述第一客户端的连接。
  18. 根据权利要求14所述的方法,其中,响应于所述状态变更请求为麦克风状态切换请求,所述业务服务器根据所述麦克风状态切换请求更新所述第一客户端的麦克风状态信息,向所述第一客户端返回麦克风状态切换确认信息;
    其中,响应于接收到所述请求结果,执行所述状态变更请求对应的操作,包括:
    响应于接收到所述麦克风状态切换确认信息,向实时通信服务器发送实时通信服务请求,以使所述实时通信服务器开始或停止多媒体数据的采集和推流。
  19. 一种信息同步方法,应用于业务服务器,所述方法包括:
    接收第一客户端发送的针对多媒体房间的状态变更请求;
    根据所述状态变更请求,更新所述多媒体房间的第一房间信息,所述第一房间信息为所述业务服务器本地存储的所述多媒体房间的房间信息;
    向所述第一客户端返回所述状态变更请求的请求结果,并生成所述第一房间信息的增量消息,通过长连接向所述多媒体房间内的第二客户端发送所述增量消息。
  20. 根据权利要求19所述的方法,其中,所述生成所述第一房间信息的增量消息,通过长连接向所述多媒体房间内的第二客户端发送所述增量消息,包括:
    根据上一条增量消息的版本号,确定当前生成的增量消息的版本号;
    通过长连接向所述多媒体房间内的第二客户端发送当前生成的增量消息及对应的版本号,以使响应于所述第二客户端在接收到的增量消息的版本号大于所述第二房间信息的版本号,根据接收到的增量消息更新所述第二房间信息,并将接收到的增量消息的版本号作为更新后的所述第二房间信息的版本号。
  21. 根据权利要求19所述的方法,还包括:
    响应于在第二时间间隔内未接收到任一所述第二客户端的心跳消息,判定该第二客户端离开所述多媒体房间,更新所述第一房间信息中的客户端列表,执行所述生成所述第一房间信息的增量消息的步骤。
  22. 根据权利要求19所述的方法,还包括:
    响应于接收到任一所述第二客户端发送的房间信息获取请求,向该第二客户端返回所述第一房间信息,以使所述第二客户端将接收到的第一房间信息存储为新的第二房间信息。
  23. 根据权利要求19所述的方法,其中,响应于检测到所述业务服务器与所述第二客户端之间的长连接断开,所述方法还包括:
    接收任一所述第二客户端发送的增量消息获取请求,所述增量消息获取请求携带该第二客户端存储的第二房间信息的版本号;
    响应于任一增量消息的版本号大于所述增量消息获取请求携带的版本号,向所述第二客户端返回该增量消息;
    或,响应于增量消息的版本号均不大于所述增量消息获取请求携带的版本号,在第五时间间隔之后,向所述第二客户端返回增量消息获取结果。
  24. 根据权利要求19所述的方法,其中,响应于所述状态变更请求为创建房间请求,所述方法还包括:
    所述业务服务器根据所述创建房间请求,生成多媒体房间的基本信息,并向实时通信服务器请求实时通信服务信息,得到第一房间信息,并向所述第一客户端返回创建房间确认信息。
  25. 根据权利要求24所述的方法,其中,响应于所述状态变更请求为加入房间请求,所述第一房间信息中还包括所述多媒体房间内的客户端列表,所述根据所述状态变更请求,更新所述多媒体房间的第一房间信息,向所述第一客户端返回所述状态变更请求的请求结果,包括:
    根据所述加入房间请求,将所述第一客户端添加至所述客户端列表中,向所述第一客户端返回所述第一房间信息,以使所述第一客户端根据所述实时通信服务信息与实时通信服务器建立连接,以使所述实时通信服务器提供多媒体数据的采集和推流服务。
  26. 根据权利要求25所述的方法,其中,响应于所述状态变更请求为离开房间请求,所述根据所述状态变更请求,更新所述多媒体房间的第一房间信息,向所述第一客户端返回所述状态变更请求的请求结果,包括:
    根据所述离开房间请求,将所述第一客户端从所述客户端列表中删除,向所述第一客户端返回离开房间确认信息,以使所述第一客户端向所述实时通信服务器发送断开连接请求,以使所述实时通信服务器断开与所述第一客户端的连接。
  27. 根据权利要求26所述的方法,其中,响应于所述状态变更请求为关闭房间请求,所述根据所述状态变更请求,更新所述多媒体房间的第一房间信息,向所述第一客户端返回所述状态变更请求的请求结果,包括:
    将所述第一客户端从所述客户端列表中删除,向所述第一客户端返回离开房间确认信息,以使所述第一客户端向所述实时通信服务器发送断开连接请求,以使所述实时通信服务器断开与所述第一客户端的连接。
  28. 根据权利要求19所述的方法,其中,响应于所述状态变更请求为角色切换请求,且所述第一房间信息中还包括所述多媒体房间内每个客户端的角色信息,
    其中,所述根据所述状态变更请求,更新所述多媒体房间的第一房间信息,向所述第一客户端返回所述状态变更请求的请求结果,包括:
    根据所述角色切换请求,更新所述第一客户端的角色信息,向所述第一客户端返回所述角色切换请求的请求结果;
    其中,所述生成所述第一房间信息的增量消息,通过长连接向所述多媒体房间内的第二客户端发送所述增量消息,包括:
    生成所述第一房间信息的增量消息,通过长连接向所述角色切换请求对应的第二客户端发送所述增量消息。
  29. 根据权利要求19所述的方法,其中,响应于所述状态变更请求为麦克风状态切换请求,且所述第一房间信息中还包括所述多媒体房间内每个客户端的麦克风状态信息,
    其中,所述根据所述状态变更请求,更新所述多媒体房间的第一房间信息,向所述第一客户端返回所述状态变更请求的请求结果,包括:
    根据所述麦克风状态切换请求,更新所述第一客户端的麦克风状态信息,向所述第一客户端返回麦克风状态切换确认信息,以使所述第一客户端向实时通信服务器发送实时通信服务请求,以使所述实时通信服务器开始或停止多媒体数据的采集和推流。
  30. 一种信息同步方法,应用于第二客户端,所述方法包括:
    接收业务服务器通过长连接发送的第一房间信息的增量消息,所述第一房间信息为所 述业务服务器本地存储的所述多媒体房间的房间信息,所述增量消息为所述业务服务器根据第一客户端发送的状态变更请求更新所述多媒体房间的第一房间信息后生成的;
    根据所述增量消息,更新所述多媒体房间的第二房间信息,所述第二房间信息为所述第二客户端本地存储的所述多媒体房间的房间信息。
  31. 根据权利要求30所述的方法,其中,所述根据所述增量消息,更新所述多媒体房间的第二房间信息,包括:
    响应于接收到的增量消息的版本号大于所述第二房间信息的版本号,根据接收到的增量消息,更新所述第二房间信息,并将接收到的增量消息的版本号作为更新后的所述第二房间信息的版本号。
  32. 根据权利要求30所述的方法,还包括:
    按照第一时间间隔,向所述业务服务器发送心跳消息,以使响应于所述业务服务器在第二时间间隔内未接收到任一所述第二客户端的心跳消息,将该第二客户端从所述第一房间信息的客户端列表中删除,并执行所述生成所述第一房间信息的增量消息的步骤。
  33. 根据权利要求30所述的方法,还包括:
    按照第三时间间隔,检测与所述业务服务器之间的长连接,响应于检测到所述长连接断开,重新与所述业务服务器建立长连接。
  34. 根据权利要求30所述的方法,还包括:
    按照第四时间间隔,向所述业务服务器发送房间信息获取请求,以使所述业务服务器返回所述第一房间信息;
    将接收到的第一房间信息存储为新的第二房间信息。
  35. 根据权利要求30所述的方法,其中,响应于检测到所述业务服务器与所述第二客户端之间的长连接断开,所述方法还包括:
    发送增量消息获取请求,所述增量消息获取请求携带所述第二房间信息的版本号,以使响应于所述业务服务器在任一增量消息的版本号大于所述增量消息获取请求携带的版本号,向所述第二客户端返回该增量消息,或响应于增量消息的版本号均不大于所述增量消息获取请求携带的版本号,在第五时间间隔之后,向所述第二客户端返回增量消息获取结果。
  36. 根据权利要求30所述的方法,还包括:
    根据更新后的第二房间信息执行相应的操作。
  37. 一种信息同步装置,应用于第一客户端,所述装置包括:
    获取单元,被配置为获取针对多媒体房间的状态变更请求,将所述状态变更请求发送至业务服务器,以使所述业务服务器向所述第一客户端返回所述状态变更请求的请求结果,并通过长连接向所述多媒体房间内的第二客户端发送第一房间信息的增量消息,并使第二客户端根据所述增量消息更新第二房间信息,所述第一房间信息为所述业务服务器本地存储的所述多媒体房间的房间信息,所述第二房间信息为所述第二客户端本地存储的所述多媒体房间的房间信息;
    第一接收单元,被配置为响应于接收到所述请求结果,执行所述状态变更请求对应的操作。
  38. 一种信息同步装置,应用于业务服务器,所述装置包括:
    第二接收单元,被配置为接收第一客户端发送的针对多媒体房间的状态变更请求;
    第一更新单元,被配置为根据所述状态变更请求,更新所述多媒体房间的第一房间信息,所述第一房间信息为所述业务服务器本地存储的所述多媒体房间的房间信息;
    发送单元,被配置为向所述第一客户端返回所述状态变更请求的请求结果,并生成所述第一房间信息的增量消息,通过长连接向所述多媒体房间内的第二客户端发送所述增量消息。
  39. 一种信息同步装置,应用于第二客户端,所述装置包括:
    第三接收单元,被配置为接收业务服务器通过长连接发送的第一房间信息的增量消息,所述第一房间信息为所述业务服务器本地存储的所述多媒体房间的房间信息,所述增量消息为所述业务服务器根据第一客户端发送的状态变更请求更新所述多媒体房间的第一房间信息后生成的;
    第二更新单元,被配置为根据所述增量消息,更新所述多媒体房间的第二房间信息,所述第二房间信息为所述第二客户端本地存储的所述多媒体房间的房间信息。
  40. 一种电子设备,包括:
    处理器;
    用于存储所述处理器可执行指令的存储器;
    其中,所述处理器被配置为执行所述指令,以实现如权利要求14至18或19至29或30至36任一项所述的信息同步方法。
  41. 一种非易失性存储介质,当所述存储介质中的指令由电子设备的处理器执行时,使得所述电子设备能够执行如权利要求14至18或19至29或30至36任一项所述的信息同步方法。
  42. 一种计算机程序产品,包括计算机程序,其中,所述计算机程序被处理器执行时实现权利要求14至18或19至29或30至36任一项所述的多媒体数据播放方法。
PCT/CN2022/081012 2021-08-17 2022-03-15 一种信息同步系统、方法、及设备 WO2023019930A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110943989.XA CN113766259B (zh) 2021-08-17 2021-08-17 一种信息同步系统、方法、装置、设备及存储介质
CN202110943989.X 2021-08-17

Publications (1)

Publication Number Publication Date
WO2023019930A1 true WO2023019930A1 (zh) 2023-02-23

Family

ID=78790174

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/081012 WO2023019930A1 (zh) 2021-08-17 2022-03-15 一种信息同步系统、方法、及设备

Country Status (2)

Country Link
CN (1) CN113766259B (zh)
WO (1) WO2023019930A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113766259B (zh) * 2021-08-17 2023-01-20 北京达佳互联信息技术有限公司 一种信息同步系统、方法、装置、设备及存储介质
CN115225697B (zh) * 2022-06-16 2024-04-09 阿里云计算有限公司 状态同步方法、装置、设备及存储介质
CN115334144A (zh) * 2022-06-29 2022-11-11 上海万物新生环保科技集团有限公司 一种业务状态变更通知的处理方法、装置及系统

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150172381A1 (en) * 2013-12-15 2015-06-18 Afinos, Inc. Synchronized collaborative user interface
CN105791291A (zh) * 2016-03-02 2016-07-20 腾讯科技(深圳)有限公司 网络应用的显示控制方法、显示中实时更新的方法和装置
CN110012115A (zh) * 2019-05-06 2019-07-12 广州华多网络科技有限公司 直播间推送信息的更新方法和系统
CN110267053A (zh) * 2019-06-27 2019-09-20 广州酷狗计算机科技有限公司 直播方法、装置及系统
CN111212294A (zh) * 2018-11-22 2020-05-29 腾讯科技(深圳)有限公司 直播间的状态更新方法、装置及可读存储介质
CN113766259A (zh) * 2021-08-17 2021-12-07 北京达佳互联信息技术有限公司 一种信息同步系统、方法、装置、设备及存储介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109995741B (zh) * 2018-01-02 2021-07-23 武汉斗鱼网络科技有限公司 一种网络直播中连麦实现方法及系统
CN111818350B (zh) * 2020-06-12 2021-11-02 北京达佳互联信息技术有限公司 展示信息的方法、系统、装置、电子设备及存储介质
CN112689155B (zh) * 2020-12-22 2021-10-26 北京达佳互联信息技术有限公司 虚拟资源推送方法、装置及服务器

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150172381A1 (en) * 2013-12-15 2015-06-18 Afinos, Inc. Synchronized collaborative user interface
CN105791291A (zh) * 2016-03-02 2016-07-20 腾讯科技(深圳)有限公司 网络应用的显示控制方法、显示中实时更新的方法和装置
CN111212294A (zh) * 2018-11-22 2020-05-29 腾讯科技(深圳)有限公司 直播间的状态更新方法、装置及可读存储介质
CN110012115A (zh) * 2019-05-06 2019-07-12 广州华多网络科技有限公司 直播间推送信息的更新方法和系统
CN110267053A (zh) * 2019-06-27 2019-09-20 广州酷狗计算机科技有限公司 直播方法、装置及系统
CN113766259A (zh) * 2021-08-17 2021-12-07 北京达佳互联信息技术有限公司 一种信息同步系统、方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN113766259A (zh) 2021-12-07
CN113766259B (zh) 2023-01-20

Similar Documents

Publication Publication Date Title
WO2023019930A1 (zh) 一种信息同步系统、方法、及设备
CN106105246B (zh) 直播显示方法、装置及系统
JP6101861B2 (ja) グループ作成方法、グループ脱退方法、装置、プログラム、及び記録媒体
WO2016086581A1 (zh) 即时通讯的方法和装置
EP3113466A1 (en) Method and device for warning
WO2016192326A1 (zh) 云名片的发送方法和装置
US20120173622A1 (en) Social screen casting
US9041763B2 (en) Method for establishing video conference
US10334282B2 (en) Methods and devices for live broadcasting based on live broadcasting application
US9736518B2 (en) Content streaming and broadcasting
WO2017045307A1 (zh) 接听扩展功能显示方法及装置
WO2016011742A1 (zh) 通话方法、装置和系统
US9756373B2 (en) Content streaming and broadcasting
US20220150594A1 (en) Method for message interaction, terminal and storage medium
EP3223147A2 (en) Method for accessing virtual desktop and mobile terminal
JP2017531891A (ja) リモートアシスタンス方法、クライアント、プログラム及び記録媒体
EP2797279B1 (en) Communications using at least two different media types
WO2016045277A1 (zh) 信息获取方法、装置和系统
US20210311699A1 (en) Method and device for playing voice, electronic device, and storage medium
US11444992B2 (en) Method and apparatus for communication processing
CN109302341B (zh) 即时通信方法、装置、电子设备及存储介质
CN114095288A (zh) 用户群组交互方法、装置及电子设备
WO2020038171A1 (zh) 撤回图片文件的方法及其控制方法、装置及移动终端
CN111355973B (zh) 数据播放方法、装置、电子设备及存储介质
WO2020186929A1 (zh) 直播中的交互方法、装置、电子设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22857250

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE