A method, device and medium for multi-terminal collaborative screen control for classroom large screens

By constructing a four-level MQTT topic namespace and a three-terminal subscription relationship, the problem of state consistency in multi-terminal collaborative screen control in the classroom is solved, the role isolation and permission convergence of the terminals are realized, the smoothness of teacher operation and the fairness of student terminal are ensured, countdown drift is eliminated, and the terminal exit mechanism is unified.

CN123067809APending Publication Date: 2026-11-10SHANDONG DACHOO INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611077954.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-20
Publication Date
2026-11-10

AI Technical Summary

Technical Problem

In the process of multi-terminal collaborative screen control and multi-question answering on the classroom screen, the lack of a unified hierarchical theme architecture and authoritative state management on the server side makes it impossible to guarantee the consistency of state collaboration among multiple terminals. This leads to frequent splitting of the state view of the three terminals during classroom interaction, fragmented teacher operation experience, and difficulty in ensuring fairness on the student side.

Method used

By constructing a four-level MQTT topic namespace on the server side, a three-terminal subscription relationship is established between the control terminal, the large screen terminal, and the student terminal. A unique authoritative status parameter is obtained, exclusive control arbitration is performed, a unique control terminal is determined, and a remaining time heartbeat message is published through timer configuration information and countdown channel topics to ensure that the terminal synchronizes the view.

Benefits of technology

It achieves role isolation and permission convergence at the protocol layer for the control terminal, large screen terminal, and student terminal, solves the problems of mutual pollution between different classroom broadcasts and the student terminal being able to subscribe to teacher topics, ensures the consistency of terminal status and the smoothness of teacher operation, avoids dual control or silent coverage phenomenon when switching teacher devices, eliminates countdown drift caused by network latency and local timing, and unifies the terminal exit mechanism.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123067809A_ABST
    Figure CN123067809A_ABST
Patent Text Reader

Abstract

This specification discloses a multi-terminal collaborative screen control method, device, and medium for classroom large screens, relating to the field of educational informatization technology. The method includes: constructing a four-level MQTT topic namespace on the server, establishing a three-terminal subscription relationship, determining the three-terminal subscription channel, and obtaining a unique authoritative state parameter shared by the three terminals; performing exclusive arbitration of control rights based on the ownership of control rights to determine the current unique control terminal to receive push question instructions, matching the corresponding question type strategy based on the answer mode identifier, and determining timer configuration information; starting the server-side timer through the timer configuration information, using the countdown channel to identify the corresponding topic, publishing a remaining time heartbeat message, and obtaining a synchronization view for each terminal; based on the remaining answer time rendered in the synchronization view, when the timeout event or the all-submission event of the current question is triggered, advancing the question status to the completed state so that each terminal synchronously exits the answer interface of the current question.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This manual relates to the field of educational informatization technology, and in particular to a multi-terminal collaborative screen control method, device and medium for classroom large screens. Background Technology

[0002] In classroom teaching information technology scenarios, interactive teaching systems based on large screens typically involve three types of terminals: the control terminal used by the teacher (such as a mobile phone, tablet, or teacher's computer), the large screen terminal used for display, and the student terminal used by the students. To facilitate activities such as distributing questions, collecting answers, and quizzing in the classroom, existing solutions mainly fall into three categories. The first category is answer plugins or classroom aids based on HTTP polling. In this type of solution, the student terminal pulls questions or statuses from the server at fixed time intervals, and the server passively responds to the requests. This type of solution has significant drawbacks in quiz scenarios. Because the time it takes for requests from each terminal to reach the server is affected by network latency, the server cannot accurately determine the order of quizzes, leading to inconsistencies in the arbitration results among multiple student terminals. Simultaneously, each terminal maintains its own countdown timer, and due to network jitter and differences in polling intervals, the remaining time displayed on different terminals often drifts, failing to achieve second-level synchronization requirements. The second type is online education platforms based on WebSocket long connections, which maintain an independent long connection for each student, allowing the server to proactively push messages. However, teachers need to manage the connections of all students in the classroom simultaneously. As the number of students increases, the server connection overhead grows linearly, limiting scalability. Furthermore, when students reconnect after network fluctuations, the original session state is difficult to restore quickly, often requiring re-login or loss of current answer progress. The third type is IoT interaction solutions based on the MQTT protocol, utilizing MQTT's publish-subscribe model to broadcast messages, reducing the complexity of server connection management. However, in existing implementations, MQTT topics typically use flat naming or only have two or three levels, without role isolation for classroom scenarios. Message broadcasts between different classrooms are prone to mutual contamination, and students in the same classroom may subscribe to control topics that shouldn't be visible, posing a cheating risk. Additionally, this type of solution doesn't address the unique issue of exclusive control in classroom interaction. When teachers switch devices, multiple control terminals may operate the same classroom simultaneously, leading to command conflicts and disputes during concurrent answering. There's also the problem of not being able to reuse the original session after reconnection, requiring students to rejoin.

[0003] In summary, the lack of a unified hierarchical theme architecture and authoritative server-side state management in the process of multi-terminal collaborative screen control and multi-question answering for classroom large screens makes it impossible to guarantee the consistency of state collaboration among multiple terminals. This results in frequent splitting of the state views of the three terminals during classroom interaction, fragmented teacher operation experience, and difficulty in ensuring fairness on the student side. Summary of the Invention

[0004] This specification provides one or more embodiments of a multi-terminal collaborative screen control method, device, and medium for classroom large screens, which is used to solve the following technical problems: In the process of multi-terminal collaborative screen control and multi-question answering for classroom large screens, the lack of a unified hierarchical topic architecture and server-side authoritative state management leads to the inability to guarantee the consistency of state collaboration among multiple terminals, resulting in frequent splitting of the state view of the three terminals during classroom interaction, fragmented teacher operation experience, and difficulty in guaranteeing fairness on the student end.

[0005] One or more embodiments of this specification employ the following technical solutions: This specification provides one or more embodiments of a multi-terminal collaborative screen control method for classroom large screens. The method includes: constructing a four-level hierarchical MQTT topic namespace on a server, obtaining hierarchical topics to establish a three-terminal subscription relationship, determining the corresponding subscription channels for the control terminal, the large screen terminal, and the student terminal, and based on the three-terminal subscription channels, obtaining a unique authoritative state parameter shared by the three terminals. The unique authoritative state parameter includes question status, control ownership, answer-grabbing status, and timeout flag. The first level of the hierarchical topic is a classroom activity identifier, the second level is a grade identifier, the third level is a role identifier, and the fourth level is a behavior identifier. The role identifier includes at least a control terminal identifier, a large screen terminal identifier, a student terminal identifier, and a countdown channel identifier. Based on the control ownership... The system employs an exclusive arbitration mechanism to determine the current sole control terminal. It receives push notifications for questions from this terminal and matches the corresponding question type strategy from multiple predefined strategies based on the answer mode identifier in the push notification. It then determines the timer configuration information corresponding to the question type strategy. A server-side timer is started using this timer configuration information, and a countdown channel identifier is used to identify the corresponding topic. Remaining time heartbeat messages are published at a fixed frequency, and a synchronization view of each terminal subscribing to these remaining time heartbeat messages is obtained. Based on this synchronization view, the remaining answer time for the current question is rendered on each terminal. When a timeout event or a full submission event for the current question is triggered, the question status is advanced to the completed state, causing all terminals to synchronously exit the answer interface for the current question.

[0006] This specification provides one or more embodiments of a multi-terminal collaborative screen control device for classroom large screens, including: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the above-described method.

[0007] This specification provides one or more embodiments of a non-volatile computer storage medium storing computer-executable instructions configured to perform the above-described method.

[0008] The above-described at least one technical solution used in the embodiments of this specification can achieve the following beneficial effects: By constructing a four-level MQTT topic namespace on the server side and establishing subscription relationships among the three terminals, the system achieves role isolation and permission convergence at the protocol layer for the control terminal, the large screen terminal, and the student terminal. This solves the problems of mutual contamination between different classroom broadcasts and the ability of students to subscribe to teacher topics in conventional solutions. The server, as the sole authoritative state holder, uniformly manages the question status, control ownership, answer-grabbing status, and timeout flags. The three terminals passively receive broadcasts as views, changing the inconsistency caused by each terminal independently maintaining its state in conventional solutions. Exclusive control arbitration determines the unique control terminal, avoiding dual control or silent overwriting phenomena that occur when teachers switch devices in conventional solutions. A dynamic question type matching strategy based on answer mode identifiers enables the server to drive different question types with a unified control link, eliminating the need to repeatedly develop countdown and timeout logic for each question type. The server publishes remaining time heartbeat messages at a fixed frequency, and all terminals render the countdown based on the same synchronous view, eliminating the drift problem caused by network latency and local timing in conventional solutions. Ultimately, when the timeout period expires or all participants submit their answers, the question status is uniformly updated to "completed," ensuring that all three platforms exit the answering interface simultaneously. This solves the long-standing pain point of inconsistent completion determination across different terminals in conventional solutions. Attached Figure Description

[0009] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings: Figure 1 A flowchart illustrating a multi-terminal collaborative screen control method for classroom large screens, provided as an embodiment of this specification; Figure 2 This is a schematic diagram illustrating the state transition corresponding to a question state, provided in an embodiment of this specification. Figure 3 A schematic diagram of a control exclusive arbitration process provided for embodiments of this specification; Figure 4 This is a schematic diagram of a quiz-taking process provided in an embodiment of this specification; Figure 5 A schematic diagram of a three-segment countdown quiz process provided for an embodiment of this specification; Figure 6 A schematic diagram illustrating a client-identified consistency session re-entry process provided in an embodiment of this specification; Figure 7 A schematic diagram of a multi-terminal collaborative control system for classroom large screens provided in the embodiments of this specification; Figure 8 This is a schematic diagram of the structure of a multi-terminal collaborative screen control device for classroom large screens, provided as an embodiment of this specification. Detailed Implementation

[0010] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments of this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.

[0011] This specification provides a multi-terminal collaborative screen control method for classroom large screens. It should be noted that the execution subject in this specification can be a server or any device with data processing capabilities. Figure 1 This is a flowchart illustrating a multi-terminal collaborative screen control method for classroom large screens, as provided in the embodiments of this specification. Figure 1 As shown, the main steps include the following: Step S101: Construct a four-level MQTT topic namespace on the server side, obtain hierarchical topics, establish a three-terminal subscription relationship, determine the three-terminal subscription channels corresponding to the control terminal, the large screen terminal, and the student terminal, and obtain the unique authoritative status parameter shared by the three terminals based on the three-terminal subscription channels.

[0012] The hierarchical theme is structured with four levels: first, classroom activity identifiers; second, grade identifiers; third, role identifiers; and fourth, behavior identifiers. Role identifiers include at least the control terminal identifier, large screen terminal identifier, student terminal identifier, and countdown channel identifier. The question status includes not started, waiting, in progress, answering, finished, and session ended.

[0013] In one embodiment of this specification, when the server starts, it generates an MQTT topic namespace for the classroom according to a four-level hierarchy of "classroom activity dimension / grade dimension / role dimension / behavior dimension". This namespace is the foundation for all subsequent message publishing and subscription steps. Compared with the existing flat topic scheme, it can simultaneously support classroom isolation, role permissions, and subtree wildcard subscription. Specifically, each MQTT topic is uniformly organized into a four-level hierarchy, from top to bottom: classroom activity dimension / grade dimension / role dimension / behavior dimension.

[0014] The first level is the classroom activity dimension, which is the classroom activity identifier. It is a unique number for a classroom activity and is used to solve the problem of mutual pollution of broadcasts from different classrooms in the existing tiling theme scheme. The classroom is used as the highest level namespace, so that the message middleware can complete the physical isolation of the classroom at the first level. For example, if a school has dozens of classrooms having classes at the same time, it is necessary to ensure that the answering message in classroom A will not enter classroom B.

[0015] The second level is the grade dimension, which is the grade identifier, a unique number for a grade or class. It solves the problem that multiple classes cannot be scored independently when the same activity is taught in parallel in the existing solution. By dividing the classroom activity by the grade dimension, each class can subscribe to its own subtree. For example, in scenarios such as grade joint exams or cross-class competitions, multiple classes can be attached to one activityId at the same time.

[0016] The third level is the role dimension, i.e., role identifiers, including the control terminal identifier of the control terminal, the large screen identifier of the large screen terminal, the student terminal identifier of the student terminal, and the countdown channel identifier of the countdown channel. It also includes roles or dedicated channels such as kick-out channel, buzzer channel, PK, risk question, flying flower order, time trial, handwriting question, etc., to solve the problem that role permissions are difficult to converge in the existing solution and that the student terminal can subscribe to the teacher terminal's topics. By dividing the subtree by role under the grade, each role can only subscribe to the subtree it needs. The student terminal should not be able to subscribe to the synchronous topics of the control terminal, otherwise it can cheat and predict the teacher's next action.

[0017] The fourth dimension is the behavior dimension, which consists of behavior identifiers, including question distribution, answer feedback, ranking, status broadcasting, synchronization, instructions, and next round. This addresses the problem in existing solutions where message types are mixed under a single role, requiring clients to perform extensive classification at the business layer. By further subdividing behavior types under the role subtree, clients can use MQTT wildcards to subscribe on demand. The large screen only needs to display the questions and status, without needing to worry about control instructions; after subdividing by behavior dimension, only the relevant behaviors are subscribed to and displayed.

[0018] The above hierarchy is designed based on the principle of gradually reducing the visible range from top to bottom. The first level solves classroom isolation, the second level solves class isolation, the third level solves role permissions, and the fourth level solves behavior type distribution.

[0019] In one embodiment of this specification, the three-terminal subscription relationship includes the control terminal subscribing to the subtree containing the control terminal identifier, the large screen terminal subscribing to the subtree containing the large screen terminal identifier, and the student terminal subscribing to the subtree containing the student terminal identifier. Specifically, the subscription scope of each terminal in the three-segment subscription model is as follows: The subscription content for the large screen terminal is as follows: subscribe to all behaviors under the large screen terminal tree for this class × this grade × large screen terminal; subscribe to the global broadcast for this class × this grade × countdown channel; subscribe to the buzzer channel for this class × this grade ×; and subscribe to subtrees for question types such as PK, risk questions, flying flower orders, timed competitions, and handwritten questions. The subscription content for the student terminal is as follows: subscribe to all behaviors under the student terminal tree for this class × this grade × student terminal. The joining behavior reuses to carry the buzzer control event, including three types: start countdown preparation, enter buzzer, and buzzer timeout. It also subscribes to the kick-out channel for this class × this grade × student ID and the countdown channel for this class × this grade. The subscription content for the control terminal is as follows: subscribe to the synchronization behavior for this class × this grade × control terminal ×; and subscribe to the status behavior for this class × this grade × control terminal ×. This is used to detect events of being preempted and disconnected, and interacts with the backend via HTTP, with the backend acting as a proxy to publish instruction behavior messages. By layering and role-based division, we achieve natural isolation at the classroom level (physical isolation between different classrooms), convergence of role permissions within the same classroom (students cannot subscribe to synchronized topics on the control end), and batch subscription of wildcard subtrees (the large screen can subscribe to all displayed messages at once).

[0020] In one embodiment of this specification, the unique authoritative state parameters include the question status, control ownership, answer-grabbing status, and timeout flag. Specifically, four types of persistent data are initialized and maintained in Redis and MySQL. The question status can be referred to as a grade status snapshot, stored in MySQL as a single table of screen activity grades, containing the current activity status, current answering mode, current question number, and current question status. The answer-grabbing status is stored in a Redis hash structure, with the key "this class + this grade," and contains the question number, answer-grabbing stage status, answer-grabbing start time, answer-grabbing timeout duration, winner number, and winning time. The timeout flag, also known as a timeout student flag, is stored in Redis as a regular key, with the key "this class + this grade + this question + this student." The timeout flag is used to mark that the student has timed out on the question, and this key has a 24-hour lifespan.

[0021] In one embodiment of this specification, the question state corresponds to the state transitions of the question state machine, including: not started, waiting, in progress, answering, finished, and the entire session ended. Figure 2 This is a schematic diagram illustrating the state transition corresponding to a problem state, as provided in an embodiment of this specification. Figure 2As shown, "Not Started" means the grade level has not yet been selected by any control terminal; "Waiting" means the control terminal has successfully selected the grade level through control arbitration, but has not yet released any questions; "In Progress" means at least one question has been released, but the student is not currently in the answer window for a specific question; "Answering" means the student is currently in the answer window for a specific question (including the buzzer window and the answer window); "Ended" means the current question has ended (including combined states such as normal end, buzzer timeout, answer timeout, and all participants submitting); "End of Session" means the last question has ended, and the entire class activity has ended. It should be noted that any state transition of the above question state machine simultaneously completes the snapshot writing to MySQL, broadcasting to the large screen via the large screen × state behavior topic, and synchronizing to the control terminal via the control terminal × synchronization behavior topic, ensuring that the three terminals view the same information. Figure 1 To.

[0022] In existing technologies, MQTT topics are mostly flat or only two-level (e.g., "Classroom / Equipment"), failing to directly target role-based access control as a design objective. This specification's embodiment constructs a four-level topic structure: "Activity / Grade / Role / Behavior." This topic forcibly binds the control panel, the large screen, and the student terminal to their respective role subtrees. The subscription channel initializes authoritative server data. By using the role identifier as a fixed third level of the topic, the student terminal cannot subscribe to messages from the control panel or the large screen at the protocol layer (even a forged client cannot receive them), achieving natural isolation without application-layer authentication. Simultaneously, the acquired subscription channel directly serves as the transmission basis for status broadcasts, forming a closed-loop architecture where topic equals permission and subscription equals access control.

[0023] Step S102: Based on the ownership of control, execute exclusive arbitration of control rights to determine the current unique control terminal, so as to receive the push question instruction sent by the current unique control terminal, match the corresponding question type strategy from multiple predetermined question type strategies based on the answer mode identifier in the push question instruction, and determine the timer configuration information corresponding to the question type strategy.

[0024] Based on the control ownership, an exclusive arbitration of control rights is executed to determine the current unique controlling end. Specifically, this includes: receiving a grade selection request from the controlling end; extracting the classroom activity identifier, grade identifier, and the client identifier of the controlling end from the grade selection request; locating the control ownership key corresponding to the control ownership in Redis based on the classroom activity identifier and grade identifier; performing an atomic operation to write the client identifier to the control ownership key only if the control ownership key does not exist, and obtaining the execution result of the atomic operation; if the execution result is a write failure, publishing a preemption message to the hierarchical topic based on the classroom activity identifier and grade identifier; re-executing the atomic operation after an existing controlling end releases the control ownership key, until a successful write result is obtained; if the execution result is a successful write, reading the current question status, current answer mode identifier, and current question number from MySQL, and returning them to the controlling end that sent the grade selection request, thus determining the current unique controlling end.

[0025] In one embodiment of this specification, Figure 3 This specification provides a schematic diagram of a control exclusive arbitration process for embodiments of the present invention, such as... Figure 3 As shown, step S3-1: The server receives a grade selection request initiated by the new control terminal, which carries the classroom activity number, grade number, and client identifier of the new control terminal; S3-2: The server, based on the "this classroom + this grade" key, sends data to Redis. Initiate an atomic write operation only if it does not exist, attempting to acquire control; Step S3-3a (acquisition success branch): If step S3-2 returns success, proceed to step S3-6; Step S3-3b (acquisition failure branch): If step S3-2 returns failure (control terminal already exists), proceed to step S3-4; Step S3-4: The server publishes a "kicked out" message to the topic "This Classroom + This Grade × Control Terminal × Status Behavior". The old control terminal must actively disconnect after subscribing to this message; Step S3-5: The server executes the atomic write operation of step S3-2 again, which will definitely succeed this time (because the old key has been released); Step S3-6: The server returns the current grade status, current answer mode, and current question number to the new control terminal, so that the new control terminal can directly jump to the current question control page (breakpoint resume); Step S3-7: The server publishes a "Grade has been selected" message to the topic "This Classroom × Global Broadcast", so that the large screen and other terminals can perceive it.

[0026] This system employs a two-phase approach: first attempt, then kick out if it fails, and finally attempt again. This avoids the silent handover caused by direct overwriting. The takeover process is pushed via a control terminal × status behavior topic. Upon receiving a kickout event, the old control terminal must disconnect. After successful takeover, the current answering mode and question number are returned, allowing the new control terminal to directly jump to the current question control page (breakpoint resumption). Based on Redis atomic operations, the takeover-kickout-retake control arbitration utilizes the acquired control ownership key to perform atomic write operations only if the key does not exist. If this fails, a takeover message is published via the acquired status behavior topic, and the write operation is retried after the old terminal releases its control. Compared to the simple method of existing technologies where new logins directly overwrite old logins or require manual release of control, this system achieves seamless, breakpoint resumption control handover through two-phase atomic arbitration and targeted kickout messages. Specifically, atomic writes ensure that only one control terminal can successfully take over at any given time. The kickout message is precisely delivered to the old control terminal via an MQTT topic, causing it to actively disconnect, avoiding zombie connections. Returning to the current question status allows the new control terminal to directly jump to the current progress. This combination solves the problem of data not being lost and operation not being interrupted when switching between multiple teacher terminals.

[0027] In one embodiment of this specification, after determining the current unique control terminal, a push question instruction sent by the current unique control terminal is received, and the corresponding question type strategy is matched from multiple predetermined question type strategies based on the answer mode identifier in the push question instruction, and the timer configuration information corresponding to the question type strategy is determined.

[0028] Based on the answer mode identifier in the pushed question instruction, the system matches the corresponding question type strategy from multiple predefined question type strategies. Specifically, this includes: extracting the classroom activity identifier, grade identifier, question number, and answer mode identifier from the pushed question instruction; querying a pre-stored routing mapping table using the answer mode identifier to obtain the question type strategy class identifier that matches the answer mode identifier, wherein the routing mapping table stores a one-to-one correspondence between the answer mode identifier and the question type strategy class identifier; and instantiating the corresponding question type strategy object based on the question type strategy class identifier, and obtaining the timer configuration information of the selected question type strategy object, wherein the question type strategy object includes a timer type parameter and a total countdown duration parameter.

[0029] In one embodiment of this specification, after receiving the push question instruction sent by the current unique control terminal, the server first parses and extracts the classroom activity identifier, grade identifier, question number, and answer mode identifier. The classroom activity identifier is a unique string number generated by the server when creating a classroom activity, used to distinguish different classrooms globally. The grade identifier is a unique number assigned by the server to each grade or class in class management, used to distinguish different teaching classes under the same classroom activity. The question number is a sequence identifier assigned by the server to each question in the question bank or activity arrangement, used to uniquely identify the specific question being pushed. The answer mode identifier is a predefined enumerated field whose values ​​correspond to various answer formats supported in classroom interaction, such as mandatory on-screen questions, on-screen buzzer-style questions, on-screen handwriting questions, on-screen PK, on-screen timed competitions, on-screen risk questions, or on-screen word games. After extracting the answer mode identifier, it is used as a query key to access a routing mapping table pre-stored in memory or a database. The routing mapping table is a key-value mapping structure, where each entry establishes a one-to-one correspondence between an answer mode identifier and a question type strategy class identifier. The question type strategy class identifier is a unique identifier for each question type strategy implementation class in the server-side code. For example, it can be the fully qualified name of the class or the registered name in the strategy factory.

[0030] The following is an example of a routing mapping table provided in the embodiments of this specification: When the answer mode is marked as "Screen Mandatory," the route is to the mandatory answer strategy, which starts a single-question countdown. When the answer mode is marked as "Screen Buzzer," the route is to the buzzer strategy, which performs atomic arbitration and configures the buzzer window timeout. When the answer mode is marked as "Screen Handwriting Question," the route is to the handwriting strategy, which distributes questions through the handwriting subtopic and maintains the completed set. When the answer mode is marked as "Screen PK," the route is to the PK strategy, which starts a countdown for the entire event. When the answer mode is marked as "Screen Time Trial," the route is to the time trial strategy, which performs a phased countdown closing. When the answer mode is marked as "Screen Risk Question," the route is to the risk question strategy, which interacts with messages through the round subtopic, judgment subtopic, and ranking subtopic. When the answer mode is marked as "Screen Flying Flower Order," the route is to the flying flower order strategy, which interacts with messages through the round subtopic and keyword subtopic.

[0031] A precise matching query is performed using a routing mapping table to obtain the corresponding question type strategy class identifier based on the input answer mode identifier. After obtaining the question type strategy class identifier, a strategy factory or dependency injection container is invoked to dynamically instantiate a specific question type strategy object based on this identifier. This instantiation process is completed through reflection or a pre-registered constructor, eliminating the need for hard-coding the specific strategy type at compile time. The instantiated question type strategy object encapsulates the timing behavior parameters specific to that question type, including at least a timer type parameter and a total countdown duration parameter. The timer type parameter indicates which timing task model the server-side countdown scheduling module should use, such as a one-time delay timer for waiting in the answer window or a periodic timer for continuous heartbeat pushes in the answer window. The total countdown duration parameter specifies the complete time length from the start of the countdown to the occurrence of timeout under that question type; its specific value is preset by the question type strategy according to the teaching scenario. The server reads these two parameters from the strategy object to obtain all the configuration information required to subsequently start the server-side timer, thus completing the matching of the question type strategy and the acquisition of the timer configuration information.

[0032] By using the answer mode identifier as a unified routing key and leveraging a pre-stored routing mapping table to dynamically route different question types to their corresponding strategy objects, decoupling question type recognition from business execution is achieved. Since the strategy object encapsulates timer type parameters and total countdown duration parameters, the server does not need to write conditional branches for each question type in the control chain; it only needs to uniformly start the timer based on the configuration information provided by the strategy object, significantly reducing the complexity of the control-side instruction processing module. Simultaneously, all question types share the same countdown push framework and timeout termination process, avoiding countdown synchronization differences and inconsistent end states caused by different implementation methods for each question type. When new question types need to be added, only a mapping relationship needs to be added to the routing mapping table and the corresponding strategy class implemented; there is no need to modify the existing subscription model, control arbitration logic, or timeout termination process, greatly improving the system's maintainability and scalability. Furthermore, since the question type strategy object is dynamically instantiated at runtime, the server can flexibly combine different question types according to classroom activity configurations without redeploying or restarting the service, providing solid technical support for the diversity and flexibility of classroom teaching.

[0033] Step S103: Start the server timer through the timer configuration information, and use the countdown channel to identify the corresponding topic to publish the remaining time heartbeat message at a fixed frequency, and obtain the synchronization view of each terminal subscribing to the remaining time heartbeat message.

[0034] In one embodiment of this specification, after the server completes the question type strategy matching and obtains the timer configuration information of the selected question type strategy object, it reads the timer type parameter and the total countdown duration parameter from the configuration information. The timer type parameter indicates the timed task model required for the current question type. For example, for mandatory questions, a single periodic timed task that decreases from the total countdown duration to zero needs to be started; for buzzer-answer questions, different types of timers need to be started for the preparation phase, the buzzer-answering window phase, and the answering window phase, respectively. The preparation phase uses a delayed timer, the buzzer-answering window phase uses a one-time timeout timer, and the answering window phase uses a periodic timer. Regardless of the timer type used, when starting the timer, the server uses the topic corresponding to the countdown channel identifier in the four-level hierarchical topic as the publication channel for the countdown heartbeat message.

[0035] Specifically, the countdown scheduling module on the server maintains a scheduled task manager with a combined key of the classroom activity identifier and the grade identifier. When a server-side timer is started, the scheduling module creates a corresponding scheduled task instance based on the timer type parameter and registers the instance in the scheduled task manager. For periodic timers, the server repeatedly executes the same task at fixed time intervals (determined by the system's preset countdown heartbeat frequency). Each time it executes, the server reads the remaining time value for the current task from memory or Redis. This remaining time value is calculated in real-time by the timer based on the start time recorded at startup and the length of time already elapsed. Then, following the four-level hierarchical topic assembly rules, the server assembles a complete publishing topic using the current classroom activity identifier, the current grade identifier, the countdown channel identifier, and the heartbeat behavior identifier as four paths. The server publishes a heartbeat message carrying the current remaining time value on this topic via MQTT.

[0036] Meanwhile, all terminals with established subscription relationships, including the large screen terminal, the control terminal, and each student terminal, have already subscribed to the subtree containing the countdown channel identifier in the previous steps. Specifically, the large screen terminal subscribed to a wildcard topic in the form of "classroom activity identifier / grade identifier / countdown channel identifier / ", and the control terminal and student terminals also receive messages from this channel through their respective subscription relationships. Therefore, when the server publishes a heartbeat message, all terminals receive the message almost simultaneously and parse the current remaining time value from it. Each terminal maintains a display component locally for rendering the countdown. This component does not hold any local timers, nor does it automatically decrement the remaining time; instead, it directly renders the received remaining time value as the latest value. Since all terminals receive messages from the same clock source on the server, and the message content is exactly the same, the countdown value displayed on each terminal remains consistent.

[0037] Even under network jitter, where a terminal might lose several heartbeat messages, when the next heartbeat arrives, the terminal directly overwrites its local display with the newly received remaining time value, skipping the lost time period. This fundamentally eliminates the cumulative drift caused by network latency or packet loss, because the terminal never relies on local timekeeping for decrementing; it only passively accepts the authoritative value published by the server. Thus, the server obtains a synchronized view formed by each terminal's subscription to remaining time heartbeat messages. This view is essentially a consistent understanding of the remaining answer time for the current question, established by all terminals based on the same heartbeat message sequence.

[0038] Step S104: Based on the synchronous view, render the remaining answer time for the current question on each terminal. When the timeout event or the all-submit event for the current question is triggered, advance the question status to the completed state so that each terminal exits the answer interface for the current question synchronously.

[0039] Based on the established synchronized view, each terminal continuously receives countdown heartbeat messages from the server. Upon receiving each heartbeat message, the remaining time value is parsed, and the local user interface rendering function is invoked to display the value on the screen as a number, progress bar, or circular countdown dial. Because all terminals render values ​​from the same source, the countdown numbers displayed on the student terminals, large screen terminals, and control terminals remain consistent in real time, allowing teachers and students to accurately grasp the remaining time without relying on their respective devices' local clocks. During the countdown, the server continuously monitors two possible events that could trigger the end of the question. The first is a timeout event, where the server's timer naturally decreases to zero according to the preset total countdown duration, triggering a timeout callback. The second is a full submission event, where the server receives a signal that all students have submitted their answers for the current question; this signal is calculated in real-time by the server when students submit their answers. Regardless of which event is triggered, the server enters a unified question-ending processing procedure.

[0040] Upon detecting a timeout or all-submit event, the server first invokes the question status advancement module to update the current question's status field in the server's authoritative state machine. This updates the current status (usually "answering") for the set of students who haven't submitted to the current status field in the "Answering" field to "Completed." This status update is simultaneously written to the grade-level status snapshot table in the MySQL database and the runtime state cache in Redis. Then, the server publishes a stop event message through the countdown channel, identifying the corresponding topic. This message differs from the aforementioned heartbeat message; it carries a stop command instead of a time value. Upon receiving the stop event message, each terminal immediately stops rendering the countdown interface and hides or disables the countdown display area.

[0041] Meanwhile, the server also publishes a "Question Completed" status message through a status behavior topic containing the large-screen identifier. This message's publication topic is constructed according to a four-level hierarchical topic assembly rule: Classroom Activity Identifier / Grade Identifier / Large-Screen Identifier / Status Behavior. Since the large-screen terminal has already subscribed to the subtree containing the large-screen identifier when establishing the subscription relationship, it can receive this message. After receiving the "Question Completed" status message, the large-screen terminal parses the status value and switches the current question display interface to the results summary interface or closes the answer window. The control terminal, through its subscribed synchronous behavior topic, also receives this status change, thus displaying a "Question Completed" marker in the teacher's control interface. The student terminal receives the same message through the status behavior topic in its subscribed student terminal subtree, stops the response of the answer input component, and may display answer explanations or wait for the next question.

[0042] Because all terminals switch interfaces based on the same set of stop events and question completion status messages published by the server, and the server ensures that the messages are published in order, each terminal exits the answer interface for the current question simultaneously. This avoids inconsistencies where some terminals still display the answer interface while others have finished. The three terminals converge to a consistent question completion status at the same time, laying a unified foundation for pushing the next question or concluding the entire class activity.

[0043] Based on the question type strategy, a server-side timer is started, and a heartbeat indicating the remaining time is published through the countdown channel. Upon timeout or submission by all participants, a flag is written using the obtained timeout flag key format, the state machine is advanced, and a stop event and a question-ending status are published. In existing solutions, countdowns are typically timed locally on each terminal, leading to drift due to network latency; timeout handling is scattered across the logic of each terminal. This embodiment centralizes all timing authority on the server, with terminals only passively rendering heartbeat values, fundamentally eliminating drift. Furthermore, the timeout closing does not differentiate between question types, uniformly executing the sequence of writing the timeout flag, advancing the status, publishing the stop event, and publishing the ending status, ensuring complete consistency of the final view across all three terminals, regardless of whether it's a mandatory question, a buzzer-beater question, or other question types. The pre-dependency of the timeout flag key format must be used to strongly couple the timeout logic with the server-side authority data, avoiding inconsistencies caused by separate timeout implementations for each question type.

[0044] When the timeout event or the all-submit event for the current question is triggered, the question status is advanced to the completed state. Specifically, this includes: retrieving the classroom activity identifier, grade identifier, and question number for the current question; reading the student identifiers of all students who have not submitted for the current question from the server-maintained set of students who have not submitted, and obtaining a list of students who have not submitted; iterating through this list of students who have not submitted, using the combination of the classroom activity identifier, grade identifier, question number, and student identifier as the key, performing a write operation on each student identifier in Redis, setting the value of the key to a timeout flag, and setting the key's lifespan parameter, and retrieving each timeout flag record; calling the question status advancement method to update the status field of the current question stored in MySQL to the completed value, and obtaining the updated question status; publishing a stop event message through this hierarchical topic, and simultaneously publishing a question status message carrying the completed value through this hierarchical topic; reading the score data and participation record for the current question from the answer record buffer, and writing the score data and participation record to the answer details table and participation record table in MySQL.

[0045] In one embodiment of this specification, the server receives a push command for a question from the control terminal via the control terminal × command behavior channel. The command carries the activity number of the current class, the grade number, the question number, and the current answering mode. The server routes the command to the corresponding question type strategy based on the current answering mode. The selected question type strategy calls its respective method to start a single-question countdown or a dedicated countdown. When the question triggers a timeout event or a full submission event, regardless of the question type, a unified timeout closure is initiated. The server calls the unified closure method to write a timeout flag with the key "this class + this grade + this question + this student" for each student in the set of students who have not yet submitted for the question, with a 24-hour lifespan. It then calls the question status advancement method to set the question status to "completed." The server publishes a stop event through the countdown channel theme. The server publishes the question's completed status through the large screen × status behavior theme. Finally, the server writes the score and participation record for the question to the database.

[0046] Once a timeout or full submission event is triggered, the server first retrieves a list of student identifiers for all students who have not submitted for the current question. Then, for each student who has not submitted, a timeout flag is written to Redis using a combination of the class activity identifier, grade identifier, question number, and student identifier as the key, and a lifespan is set to ensure that these students are correctly marked as not having answered within the timeout period in subsequent statistics. Next, the question status advancement method is called to update the question status field in MySQL to "completed," and a stop event message is published through the countdown channel topic. Simultaneously, a question status message carrying the "completed" value is published through the status behavior topic on the dashboard. Finally, the score data and participation records are written to the database. The entire closing process is executed sequentially, and any failure at any stage can be rolled back. The unified closing mechanism ensures that regardless of how the question ends, the status changes received by all three ends are completely consistent, and the records in the database are accurate.

[0047] When a new question type needs to be added, a topic constant corresponding to the question type is added to the MQTT publish service, the strategy method for the question type is implemented in the answer service or countdown service, and a mapping relationship between the answer mode identifier and the question type strategy class identifier is added to the routing mapping table. This does not require modification of the three-terminal subscription relationship, nor does it require modification of the steps to advance the question status to the completed state.

[0048] When the question type strategy is a buzzer-style strategy, the method further includes: extracting the classroom activity identifier, grade identifier, and question number from the question push instruction; locating the buzzer-style hash structure in Redis based on the classroom activity identifier and grade identifier, wherein the buzzer-style hash structure includes a question number field, a buzzer-style status field, and a winner number field; reading the question number field from the buzzer-style hash structure and comparing it with the question number; if the comparison matches, reading the buzzer-style status field and determining that the current value of the buzzer-style status field is "answering"; receiving a buzzer-style request sent by the student, and extracting the buzzer-style classroom activity identifier, buzzer-style question number, and buzzer-style student identifier from the buzzer-style request to verify the buzzer-style classroom activity identifier, buzzer-style question number, and buzzer-style student identifier. If the classroom activity identifier matches the classroom activity identifier and the question number matches the question number, the verification result is obtained. Only if the winner number field does not exist and the verification result is obtained, an atomic operation is performed on the winner number field in the answer state hash structure to write the student identifier of the answerer, and the execution status of the atomic operation is obtained. If the execution status is successful, the started answer window timeout timer is canceled, the written value of the winner number field is read from the answer state hash structure as the winner identifier, and a winner announcement carrying the winner identifier is published through the hierarchical topic. If the execution status is failed, a response message carrying a hint that a winner has been obtained is returned to the student who sent the answer request.

[0049] Assuming there are N concurrent student endpoints attempting to answer the question, in this embodiment, Figure 4 This specification provides a schematic diagram of a quiz-taking process as an embodiment, such as... Figure 4 As shown, the main implementation process is as follows: Step S4-1: The server receives the response request sent by the student, which includes the activity number, the topic number, and the student's ID. Step S4-2: The server locates the answer-grabbing status hash in Redis based on the activity number and grade number of this class; if the hash does not exist or the question number does not match, it returns "This question is not in the answer-grabbing process" and ends the request. Step S4-3: The server checks whether the status field of the answer-grabbing stage is "answering". If not, it returns the corresponding prompt and ends the process. Step S4-4: The server performs an atomic write operation on the "Winner ID" field in the answer-grabbing state hash, writing the value as the student's ID only if the field does not exist. Step S4-5a (Write the successful branch, i.e., the winning branch): S4-5a.1: The server cancels the timeout timer task for the answer-grabbing window; S4-5a.2: Write the "Winning Time" field into the answer-grabbing state hash; S4-5a.3: Create or update participation records, answer records, and answer details in the database, with the initial value of the details marked as "unscored"; S4-5a.4: Publish a "Winner Announcement" message to the "Quick Answer Channel" topic, with the winning student's username included in the message body; S4-5a.5: Publish successful answer-grabbing events to the topics "Student End × Membership Behavior" and "Control End × Synchronization Behavior"; S4-5a.6: Start the countdown timer for the answer window; S4-5a.7: Return success to the winning student's end; Step S4-5b (Write the failed branch, i.e., the branch that was not claimed): The server returns a response message to the student indicating that "another student has already claimed the answer successfully" and that there is already a winner.

[0050] Since step S4-4 is a Redis atomic command, for the N concurrent requests, only one can enter the S4-5a branch, and the remaining N-1 can enter the S4-5b branch, thus completing the unique winner arbitration with 0 locks and O(1) complexity.

[0051] By locating the hash structure of the buzzer-style response, and verifying the question number and the buzzer-style response status, an atomic operation to write the student identifier is performed only if the winner's number field does not exist. This atomic operation is guaranteed by Redis's single-threaded model; for multiple concurrent buzzer-style requests, only one will successfully write, while the rest will fail. The entire process requires no locking, has no database transaction overhead, and has constant-time complexity, ensuring the uniqueness and determinism of the winner. Simultaneously, after the winner is determined, the server cancels the buzzer-style response window timeout and publishes a winner announcement. Unsuccessful students immediately receive a notification that a winner has been identified, preventing students from repeatedly trying to answer due to uncertainty. Arbitration and result broadcasting are completed in a single round trip using atomic operations, significantly reducing system latency and resource consumption.

[0052] Before performing the atomic operation of writing the winner's number field to the student's identifier in the answer-grabbing state hash structure, the method further includes: receiving a start-to-answer instruction, extracting a countdown timer parameter from the start-to-answer instruction, publishing a countdown start event message carrying the countdown timer parameter through the hierarchical topic, and simultaneously starting a delay timer, wherein the duration of the delay timer is equal to the countdown timer parameter; when the delay timer expires, obtaining an expiration signal, publishing an enter-to-answer event message through the hierarchical topic based on the expiration signal, and simultaneously starting a one-time timed task as a fallback for answer-grabbing window timeout, wherein the duration of the one-time timed task is equal to the countdown timer parameter. Regarding the timeout parameter for the answer-grabbing window: After the answer-grabbing request sent by the student arrives, if the write success status of the atomic operation is obtained before the expiration of the one-time timed task, the one-time timed task is canceled, and a periodic timed task is started as a countdown for the answer window. The periodic timed task publishes a heartbeat message of the remaining seconds through the hierarchical topic at fixed time intervals. If the write success status of the atomic operation is not obtained when the one-time timed task expires, an expiration signal is obtained. Based on the expiration signal, the answer-grabbing stage status field in the answer-grabbing state hash structure is updated to the answer-grabbing timeout value, and the question status advancement method is called to update the question status to "completed".

[0053] In one embodiment of this specification, the complete timeline in the quiz mode consists of three segments: a 3-second preparation period, a quiz window, and a quiz window. Each segment is driven by a different server-side component and broadcast through different themes: The preparation period lasts 3 seconds and can be configured. The driving component is a delay within the server-side quiz start method. The broadcast theme and message are to publish a countdown event to the student client × joining behavior theme; simultaneously, to publish the total quiz duration in countdown form to the quiz channel theme, causing the large screen to start rendering. The closing action is to publish an entry quiz event to the student client × joining behavior theme after the preparation period expires and start the second segment timer. The quiz window segment's quiz timeout duration is configurable. The driving component is a one-time timed task on the server. The broadcast theme and message are triggered by the student client initiating a response request, which triggers atomic arbitration. After winning, a winner announcement is published to the quiz channel theme. The closing action is to cancel the second segment task and enter the third segment if the student wins; otherwise, to set the quiz stage status to quiz timeout, set the question status to ended, and broadcast the corresponding message. The answering window segment has a configurable answering duration. The driving component is a periodic timed task on the server side once per second. The broadcast topic and message are a heartbeat message for the remaining seconds sent to the countdown channel topic every second. The winning student submits the answer or the teacher scores. The closing action is to call the unified closing process when the time comes to set the answering phase status to answering timeout.

[0054] Figure 5 This specification provides a schematic diagram of a three-segment countdown quiz system, as shown in the embodiments. Figure 5 As shown, the main steps include: Step S5.1 (Entering the preparation phase): The server receives the start-to-answer instruction, generates preparation countdown parameters (default 3 seconds), publishes a start-to-answer countdown message to the student client × joining behavior topic, and publishes a message of the total answer duration in the form of countdown numbers to the answer channel topic; Step S5.2 (From preparation stage to answering stage): After 3 seconds, the server sends an entry message to the student's × membership behavior topic to start the answering stage, and initiates a one-time timed task as a fallback for answering window timeout. Step S5.3a (Entering the answering phase during the buzzer phase and hitting the branch): If the server receives a response request from the student in the buzzer window and generates a unique winner, it cancels the second timed task and starts the third periodic timed task every second. Step S5.3b (from the buzzer phase to the end, no branch hit): If there is still no winner when the buzzer window expires, the server sets the buzzer phase status to buzzer timeout, sets the question status to ended, and broadcasts to the relevant topic; Step S5.4a (Answering stage to scoring, normal branch): The teacher completes the scoring in the answer window; Step S5.4b (Answering phase to answering timeout, timeout branch): If no judgment is made when the answering window expires, the server calls the unified closing process to set the answering phase status to answering timeout and allows teachers to enter the process to restart the answering phase.

[0055] By issuing a countdown start event and starting a delay timer, preparation time is given to students, allowing all students to simultaneously enter the answer-grabbing state. After the preparation phase, the server issues an entry-to-answer event and starts a one-time timed task as a fallback for the answer-grabbing window timeout, ensuring that the session will automatically end after the specified time even if no student answers. When a winner is determined, the server cancels the one-time timed task and starts a periodic timed task, sending heartbeats of the remaining seconds at fixed intervals through the countdown channel. None of the three terminals hold local timers; they only refresh the display based on the received heartbeats. Even if some heartbeats are lost due to network jitter, they are immediately overwritten upon arrival of the next heartbeat, and there is no cumulative drift. If there is no winner in the answer-grabbing window, the server automatically updates the answer-grabbing phase status to "answer timeout" and advances the question to the end. The entire process requires no manual intervention from the teacher.

[0056] In one embodiment of this specification, the server maintains two physically isolated sets of scheduled tasks. The first set of scheduled tasks is indexed by the classroom activity identifier and the grade identifier and is used to carry the countdown for a single question. The second set of scheduled tasks is indexed by the classroom activity identifier, the grade identifier, and the PK session identifier and is used to carry the countdown for the entire PK session. When a command to stop the countdown for a single question is received, only the first set of scheduled tasks is operated on and the second set of scheduled tasks is not operated on.

[0057] Specifically, the server uses two scheduling thread pools to handle the second segment (one-time tasks) and the third segment (tasks per second), respectively. In addition to the third segment, there is a parallel PK (player versus player) countdown, using two independent task sets: a single-question countdown set indexed by the current class and grade level; and a PK countdown set indexed by the current class, grade level, and PK session number. These two sets are physically separated and operated independently by dedicated methods for starting / stopping the PK countdown, preventing accidental stopping of the entire countdown when stopping a single question's countdown is invoked during question issuance. The student client, the large screen client, and the control client do not hold local timers; they only render the remaining seconds based on the received heartbeat. If network jitter causes several heartbeats to be missed, the next heartbeat directly overwrites them, eliminating cumulative drift.

[0058] When it is necessary to re-enact the same question, the method further includes: receiving a restart instruction, extracting the classroom activity identifier, grade identifier, and question number from the restart instruction; locating the answer state hash structure in Redis based on the classroom activity identifier and the grade identifier; deleting only the winner number field in the answer state hash structure, while retaining the question number field, the answer stage status field, and other non-winner-related fields in the answer state hash structure, so that the next round of answering can accumulate the number of times the same student has participated in the question.

[0059] In one embodiment of this specification, when the teacher determines that the winner answered incorrectly, two steps are called: ending the quiz and restarting the quiz. If the restarting method detects that the question number is the same as that in Redis, it will only delete the two fields of winner number and winning time, and retain other fields such as question number, quiz start time, quiz timeout duration, and participation history. This enables multiple rounds of quizzes on the same question, and the large screen can count the number of times each student participates.

[0060] Upon receiving a restart command, the server only deletes the winner's ID field from the hash structure of the answering state, while retaining the question number field, the answering stage status field, and other non-winner-related fields. This fine-grained reset method ensures that the number of times the same student participated in the question can still be accumulated in the next round of answering. Teachers can conduct multiple rounds of answering in class, with different winners in each round, while retaining a record of each student's answering attempts. This solution achieves continuous accumulation of participation history using the existing hash structure without introducing additional storage fields, meeting the needs of multi-round answering in teaching.

[0061] It should be noted that before determining the current sole controlling end through exclusive arbitration based on the ownership of control, the method further includes: receiving a login request sent by the student client, extracting the classroom activity identifier, student identifier, and current client identifier from the login request; retrieving an old session record in Redis using the classroom activity identifier and student identifier, obtaining the retrieval result, wherein the old session record includes an old client identifier field and a session number field; if the retrieval result indicates that the old session record does not exist, generating a new session number based on the classroom activity identifier and student identifier, creating a new session record containing the new session number and the current client identifier, and writing it to Redis. The system retrieves the old session ID from Redis and returns it to the student. If the search result indicates the existence of the old session record, it reads the value of the old client identifier field from the old session record, compares the current client identifier with the old client identifier, and determines the comparison result. If the comparison result matches, it reads the value of the session ID field from the old session record as the reused session ID and returns the reused session ID to the student. If the comparison result does not match, it deletes the old session record from Redis, publishes a kick-out message to the student-specific subtopic in the hierarchical topic based on the class activity identifier and the student identifier, creates a new session, and returns the new session ID.

[0062] In one embodiment of this specification, Figure 6 This is a flowchart illustrating a client identifier consistency session re-entry process provided in an embodiment of this specification. It should be noted that session re-entry refers to the student's client reusing the old session based on its client identifier (clientId) after disconnecting from the network or refreshing the page, without being kicked out. Figure 6 As shown, the method steps are as follows: Step S6-1: The server receives the student's login request, which includes the class activity number, the student's ID, and the client's identifier. Step S6-2: The server retrieves old sessions from Redis based on the class and student information; Step S6-3a (No old session branch: If no old session exists, create a new session directly and return the session number;) Step S6-3b (Branch Exists in Old Session): Retrieve the old client identifier saved in the old session and compare it with the client identifier in this request: Step S6-4a (identity consistency branch): Determine if it is a page refresh, use the old session, and return the original session number; Step S6-4b (identifier inconsistency branch): Determine if it is a new device login, delete the old client identifier key, publish a kick-out message to the kick-out channel × this student ID topic, then create a new session and return the session number.

[0063] In conventional solutions, when a student disconnects from the network and refreshes the page, it is often interpreted as a new device login, directly overwriting the old session. This forces students to re-enter class information or lose their current answering status. Conversely, when a new device logs in, the old session is reused, allowing the same student to be online on two devices simultaneously, potentially enabling cheating using the second device. In the embodiment described in this specification, after receiving a login request, the server retrieves the old session record from Redis and compares the old client identifier with the client identifier in the current request. If the comparison matches, it is determined that the student's page has been refreshed, the old session is reused, and the original session number is returned. The student does not need to reselect grade or question and directly resumes the classroom state before the refresh. If the comparison does not match, it is determined that the student has changed devices. In this case, the server deletes the old session record, publishes a kick-out message to the student's dedicated subtopic in the kick-out channel, immediately taking the old device offline, and then creates a new session. This solves the problem of students quickly recovering their progress after network fluctuations and eliminates the risk of a student being online on multiple devices simultaneously for cheating.

[0064] The above-described at least one technical solution used in the embodiments of this specification can achieve the following beneficial effects: By constructing a four-level MQTT topic namespace on the server side and establishing subscription relationships among the three terminals, the system achieves role isolation and permission convergence at the protocol layer for the control terminal, the large screen terminal, and the student terminal. This solves the problems of mutual contamination between different classroom broadcasts and the ability of students to subscribe to teacher topics in conventional solutions. The server, as the sole authoritative state holder, uniformly manages the question status, control ownership, answer-grabbing status, and timeout flags. The three terminals passively receive broadcasts as views, changing the inconsistency caused by each terminal independently maintaining its state in conventional solutions. Exclusive control arbitration determines the unique control terminal, avoiding dual control or silent overwriting phenomena that occur when teachers switch devices in conventional solutions. A dynamic question type matching strategy based on answer mode identifiers enables the server to drive different question types with a unified control link, eliminating the need to repeatedly develop countdown and timeout logic for each question type. The server publishes remaining time heartbeat messages at a fixed frequency, and all terminals render the countdown based on the same synchronous view, eliminating the drift problem caused by network latency and local timing in conventional solutions. Ultimately, when the timeout period expires or all participants submit their answers, the question status is uniformly updated to "completed," ensuring that all three platforms exit the answering interface simultaneously. This solves the long-standing pain point of inconsistent completion determination across different terminals in conventional solutions.

[0065] Figure 7 This specification provides a schematic diagram of a multi-terminal collaborative control system for classroom large screens, as illustrated in the embodiments of this specification. Figure 7As shown, a distributed architecture with server-side authority and three-terminal views is adopted. The backend is built on the Spring Boot framework and serves as the core control node of the entire system. It contains a control entry module, a question-answering service module, a session service module, a countdown service module, and an MQTT publishing service module. The backend connects to both Redis and MySQL: Redis stores frequently accessed runtime data such as session state, answer-grabbing status, control ownership, and timeout flags; MySQL persists structured data such as grade-level status snapshots, answer records, and participation records. The control terminal (teacher's computer or tablet) interacts with the backend only via HTTP and does not directly participate in MQTT message publishing and subscription. All control commands are processed by the backend and then broadcast via the MQTT bus. The backend itself acts as an MQTT client, establishing a long connection with an independent MQTT message middleware to publish messages such as state changes, countdown heartbeats, and question distribution to the corresponding topics. The large screen terminal and the student terminal subscribe to the topic subtrees in the MQTT message middleware that match their roles. The large screen terminal only displays the information, while the student terminal participates in interactive activities such as answering questions, answering questions, and handwriting. In this architecture, the backend is the sole state authority holder. All critical states (question status, control ownership, answer-grabbing status, timeout flag) are maintained and updated by the backend in Redis and MySQL. The large screen, control panel, and student terminals are all state views, not holding any authoritative data, and passively receiving state changes only by subscribing to MQTT messages. In other words, the control panel only interacts with the backend via HTTP; the backend acts as an MQTT client, publishing messages to the message middleware; the large screen and student terminals consume messages by subscribing to MQTT subtrees; the backend is the state authority, and all three terminals are views. This architecture eliminates the need for the server to maintain a persistent connection for each student terminal, enabling message broadcasting across all terminals in the classroom via a single MQTT connection, linearly improving system scalability. Furthermore, since all three terminals are views, any terminal refresh or reconnects to synchronize the latest state from the server, fundamentally solving the problem of inconsistent states across multiple terminals.

[0066] The following is a complete end-to-end example of a round of quiz questions provided in the embodiments of this specification: Phase 1 is the startup preparation phase, which includes the following steps: Step E1-1: The server receives the start-to-answer command sent by the control terminal via the HTTP channel; Step E1-2: The server reads the Redis hash of the answer-grabbing state to determine whether this is a second round of answer-grabbing. If the question number in the hash is the same as the question number of this time, only the two fields of winner number and winning time are deleted, and the remaining fields (including participation history) are retained. No, delete the entire hash of the answer-grabbing state and rebuild it; Step E1-3: The server writes the answer-grabbing status hash field, including the question number, the answer-grabbing stage status set to "preparing", the answer-grabbing start time, the answer-grabbing timeout duration, and sets a 1-hour survival time. Step E1-4: The server generates the first timing parameter (default 3-second preparation time) and sends a start preparation countdown message to the student client × joining behavior topic (carrying the preparation time, the timeout for answering, and a flag indicating whether to answer again). Step E1-5: The server sends a message to the topic of the buzzer channel, presenting the total buzzer time in the form of countdown numbers, so that the large screen starts rendering the countdown dial; Step E1-6: The server starts a delayed task (delayed for 3 seconds) and waits for the preparation phase to end.

[0067] Phase two is the answer-grabbing window phase, which includes the following implementation steps: Step E2-1: When the delay task of Phase 1 expires, the server will set the status of the answer-grabbing phase to "answering". Step E2-2: The server sends an entry-to-answer message to the student client regarding the "×Membership Betting" topic; Step E2-3: The server starts a one-time timeout task for the answer-grabbing window, and waits for the answer-grabbing timeout period to expire as a fallback. Step E2-4: The server concurrently receives response requests from students within the answer-grabbing window and performs atomic arbitration on each request; Step E2-5: Based on the result of E2-4, proceed to one of the following three parallel branches: Branch A: The atomic arbitration produces a single winner, proceeding to stage three; Branch B: If no winner emerges by the time the buzzer window expires, proceed to Stage Four (buzzer timeout ends). Branch C: The teacher actively ends the current round of questioning within the question-and-answer window, and proceeds to stage four.

[0068] Phase 3 is the answer window phase, accessible only from branch A, and includes the following steps: Step E3-1: The server cancels the timeout scheduled task for the answer-grabbing window started in Phase 2; Step E3-2: The server writes the winning time field into the answer-grabbing state hash; Step E3.3: The server creates or updates participation records, answer records, and answer details in the database (the initial value of the details is marked as unscored); Step E3.4: The server sends a winner announcement message to the topic of the quiz channel, carrying the username of the winning student; Step E3.5: The server sends a successful answer event to both the student client (membership behavior topic) and the control client (synchronization behavior topic); Step E3.6: The server starts a periodic timer task in the answer window every second, sending a heartbeat indicating the remaining seconds to the countdown channel topic every second; Step E3.7: The server waits for one of the following two types of events in the answer window: Event A: If the teacher scores correctly, the server writes the score, publishes the judged event to the relevant topic, and the current round ends; Event B: Teacher scores incorrectly. The server deletes the winner number and winning time fields, publishes a re-answer event to the relevant topic, returns to stage one to execute step E1-1, and carries a flag indicating whether to answer again as true. Event C: If no score is given by the time limit for answering questions, proceed to stage four (ending the timeout period).

[0069] Phase four is the unified finishing phase, which mainly includes the following steps: Step E4.1: The server calls the unified timeout closing method and completes the following steps in sequence: write the timeout flag key, advance the question status to "completed", publish a stop event to the countdown channel topic, publish the question status as "completed" to the large screen × status behavior topic, and write the score and participation record. Step E4.2: Based on the received broadcast, the three terminals converge the UI to a consistent "This question has ended" view, and the current round of the quick-response method process ends.

[0070] It should be noted that the above four stages constitute the complete process of one round of answering questions; branches A, B, and C and events A, B, and C are parallel processing paths of the machine under different inputs, rather than steps executed sequentially.

[0071] This specification also provides an embodiment of a multi-terminal collaborative screen control device for classroom large screens, such as... Figure 8 As shown, the device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the above-described method.

[0072] This specification also provides a non-volatile computer storage medium storing computer-executable instructions configured to execute the above-described method.

[0073] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, devices, and non-volatile computer storage media are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0074] The above description is merely one or more embodiments of this specification and is not intended to limit this specification. Various modifications and variations can be made to the one or more embodiments of this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of one or more embodiments of this specification should be included within the scope of the claims of this specification.

Claims

1. A multi-terminal collaborative screen control method for classroom large screens, characterized in that, The method includes: A four-level MQTT topic namespace is constructed on the server side to obtain hierarchical topics, thereby establishing a three-terminal subscription relationship and determining the corresponding subscription channels for the control terminal, the large screen terminal, and the student terminal. Based on the three-terminal subscription channels, a unique authoritative status parameter shared by the three terminals is obtained. The unique authoritative status parameter includes the question status, control ownership, answer-first status, and timeout flag. The first level of the hierarchical topic is the classroom activity identifier, the second level is the grade identifier, the third level is the role identifier, and the fourth level is the behavior identifier. The role identifier includes at least the control terminal identifier, the large screen terminal identifier, the student terminal identifier, and the countdown channel identifier. According to the control ownership, an exclusive arbitration of control rights is executed to determine the current unique control terminal, so as to receive the push question instruction sent by the current unique control terminal, and match the corresponding question type strategy from multiple predetermined question type strategies based on the answer mode identifier in the push question instruction, and determine the timer configuration information corresponding to the question type strategy; The server-side timer is started by using the timer configuration information, and the corresponding topic is identified by the countdown channel. The remaining time heartbeat message is published at a fixed frequency, and a synchronous view of each terminal subscribing to the remaining time heartbeat message is obtained. Based on the synchronized view, the remaining answering time for the current question is rendered on each terminal. When the timeout event or the all-submit event for the current question is triggered, the question status is advanced to the completed state so that each terminal exits the answering interface for the current question synchronously.

2. The multi-terminal collaborative screen control method for classroom large screens according to claim 1, characterized in that, The three-terminal subscription relationship includes the control terminal subscribing to the subtree containing the control terminal identifier, the large screen terminal subscribing to the subtree containing the large screen terminal identifier, and the student terminal subscribing to the subtree containing the student terminal identifier. The question status includes not started, waiting, in progress, answering, ended, and the entire session ended.

3. The multi-terminal collaborative screen control method for classroom large screens according to claim 1, characterized in that, Based on the aforementioned control ownership, an exclusive arbitration of control rights is conducted to determine the current sole controlling party, specifically including: Receive a grade selection request sent by the control terminal, and extract the classroom activity identifier, grade identifier, and client identifier of the control terminal from the grade selection request; Based on the classroom activity identifier and the grade identifier, locate the control ownership key corresponding to the control ownership in Redis. Only when the control ownership key does not exist, perform an atomic operation to write the client identifier to the control ownership key and obtain the execution result of the atomic operation. If the execution result is a write failure, then based on the classroom activity identifier and the grade identifier, a preemption message is sent to the hierarchical topic. After the existing control terminal releases the control ownership key, the atomic operation is executed again until a write success execution result is obtained. If the execution result is a successful write, the current question status, current answer mode identifier, and current question number are read from MySQL and returned to the control terminal that sent the grade selection request, so that the current unique control terminal can be determined by the control terminal.

4. The multi-terminal collaborative screen control method for classroom large screens according to claim 1, characterized in that, Based on the answer mode identifier in the pushed question instruction, the corresponding question type strategy is matched from multiple predetermined question type strategies, specifically including: Extract the classroom activity identifier, grade identifier, question number, and answer mode identifier from the pushed question instruction; By querying the pre-stored routing mapping table using the answer mode identifier, a question type strategy class identifier that matches the answer mode identifier is obtained. The routing mapping table stores a one-to-one correspondence between the answer mode identifier and the question type strategy class identifier. Based on the question type strategy class identifier, instantiate the corresponding question type strategy object and obtain the timer configuration information of the selected question type strategy object, wherein the question type strategy object includes a timer type parameter and a total countdown duration parameter.

5. A multi-terminal collaborative screen control method for classroom large screens according to claim 1, characterized in that, When the question type strategy is a buzzer-beater strategy, the method further includes: Extract the classroom activity identifier, grade identifier, and question number from the push question instruction. Based on the classroom activity identifier and the grade identifier, locate the answer-grabbing state hash structure in Redis. The answer-grabbing state hash structure includes a question number field, an answer-grabbing stage status field, and a winner number field. The question number field is read from the answer-grabbing state hash structure and compared with the question number. If the comparison is consistent, the answer-grabbing stage status field is read and the current value of the answer-grabbing stage status field is determined to be "answering". Receive a student's request to answer, extract the classroom activity identifier, the question number, and the student's identifier from the request, and verify that the classroom activity identifier matches the classroom activity identifier and the question number matches the question number, and obtain a verification result. Only when the winner number field does not exist and the verification result is obtained, perform an atomic operation to write the student identifier in the winner number field of the answer-grabbing state hash structure, and obtain the execution status of the atomic operation; If the execution status is successful, then cancel the started answer window timeout timer, read the write value of the winner number field from the answer state hash structure as the winner identifier, and publish the winner announcement carrying the winner identifier through the hierarchical topic; If the execution status is write failure, a response message carrying a hint of a winner is returned to the student who sent the request to answer.

6. A multi-terminal collaborative screen control method for classroom large screens according to claim 5, characterized in that, Before performing the atomic operation of writing the student identifier to the winner number field in the answer-grabbing state hash structure, the method further includes: Upon receiving the start-to-answer instruction, extract the countdown duration parameter from the start-to-answer instruction, publish a countdown start event message carrying the countdown duration parameter through the hierarchical topic, and simultaneously start a delay timer, wherein the duration of the delay timer is equal to the countdown duration parameter. When the delay timer expires, an expiration signal is obtained, and an entry-to-answer event message is published through the hierarchical topic according to the expiration signal. At the same time, a one-time timed task is started as a fallback for the answer window timeout. The duration of the one-time timed task is equal to the answer window timeout duration parameter. After the student's request to answer arrives, if the write success status of the atomic operation is obtained before the one-time timed task expires, the one-time timed task is canceled and a periodic timed task is started as a countdown for the answer window. The periodic timed task publishes a heartbeat message of the remaining seconds through the hierarchical topic at fixed time intervals. If the execution status of the atomic operation has not been successfully written by the time the one-time timed task expires, an expiration signal is obtained, and the answer-grabbing stage status field in the answer-grabbing state hash structure is updated to the answer-grabbing timeout value based on the expiration signal. The question status advancement method is then called to update the question status to "completed".

7. A multi-terminal collaborative screen control method for classroom large screens according to claim 1, characterized in that, Before determining the current sole controller by executing exclusive arbitration based on the ownership of control, the method further includes: Receive a login request sent by a student, and extract the classroom activity identifier, student identifier, and current client identifier from the login request; Using the classroom activity identifier and the student identifier, retrieve old session records in Redis to obtain search results, wherein the old session records include an old client identifier field and a session number field; If the search result indicates that the old session record does not exist, a new session number is generated based on the classroom activity identifier and the student identifier. A new session record containing the new session number and the current client identifier is created, written to Redis, and the new session number is returned to the student. If the search result indicates the existence of the old session record, then the value of the old client identifier field is read from the old session record, and the current client identifier is compared with the old client identifier to determine the comparison result; If the comparison results are consistent, the value of the session number field is read from the old session record as the retained session number, and the retained session number is returned to the student's terminal. If the comparison results are inconsistent, the old session record is deleted from Redis, and a kick-out message is published to the student-specific subtopic in the hierarchical topic according to the classroom activity identifier and the student identifier. A new session is created and the new session number is returned.

8. A multi-terminal collaborative screen control method for classroom large screens according to claim 1, characterized in that, When the timeout event or the all-submission event for the current question is triggered, the question state is advanced to the completed state, specifically including: Get the classroom activity identifier, grade identifier, and question number of the current question; read the student identifiers of all students who have not submitted their questions under the current question from the set of students who have not submitted their questions maintained by the server; and get the list of students who have not submitted their questions. Iterate through the list of unsubmitted student identifiers, using the combination of the classroom activity identifier, the grade identifier, the question number, and the student identifier as the key, perform a write operation on each student identifier in Redis, set the value of the key to a timeout flag, set the lifespan parameter of the key, and retrieve each timeout flag record; Call the question status advancement method to update the status field of the current question stored in MySQL to the "completed" value, and obtain the updated question status; A stop event message is published through the hierarchical topic, and a question status message carrying a completed value is also published through the hierarchical topic. Read the score data and participation record of the current question from the answer record buffer, and write the score data and participation record into the answer details table and participation record table in MySQL.

9. A multi-terminal collaborative screen control device for classroom large screens, characterized in that, The device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method as described in any one of claims 1-8.

10. A non-volatile computer storage medium storing computer-executable instructions, characterized in that, The computer-executable instructions are configured to perform the method as described in any one of claims 1-8.