A Programming Teaching Method and System Based on Real-Time Bidirectional Communication Technology

Online programming education platforms using real-time two-way communication technology solve the problems of inconsistent programming environments and insufficient real-time interactive capabilities, enabling efficient and real-time programming interaction between teachers and students, and improving teaching effectiveness and learning experience.

CN120956722BActive Publication Date: 2026-01-30HANGZHOU XIAOMA EDUCATION TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511468115.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-15
Publication Date
2026-01-30
Estimated Expiration
2045-10-15

AI Technical Summary

Technical Problem

Existing online programming education platforms lack embedded code editors and sandbox execution environments, resulting in inconsistent programming environments and interruptions in teaching continuity. Teachers are unable to monitor students' programming process in real time and lack real-time interactive capabilities, affecting the timeliness and accuracy of teaching feedback.

Method used

This programming teaching method employs real-time bidirectional communication technology. It enables real-time interaction between the teacher and student ends via WebSocket connection, and uses teaching instruction packages and feedback instruction packages for bidirectional data transmission. It supports the teacher to push programming questions and online IDE environment in real time, and the student end to provide timely feedback on code editing behavior and execution results.

Benefits of technology

It enables millisecond-level interaction between teachers and students, supports real-time push of programming questions and code execution, and timely captures feedback on programming behavior, thereby improving teaching efficiency and learning outcomes and reducing learning frustration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120956722B_ABST
    Figure CN120956722B_ABST
Patent Text Reader

Abstract

This application relates to the technical field of online programming education, and in particular to a programming teaching method and system based on real-time bidirectional communication technology, comprising the following steps: receiving a WebSocket connection request initiated by a client and establishing a secure connection, wherein the client includes a teacher end and a student end; based on the established connection, receiving a teaching instruction packet initiated by the teacher end and sending it to the target student end; receiving a feedback instruction packet initiated by the student end and sending it to the target teacher end; receiving a disconnection request and deleting the corresponding record in the strong association; the disconnection request is initiated by the client or detected by the server; this application has the advantages of ultra-low latency bidirectional interaction driven by programming, real-time closed loop of instructional programming content and execution feedback, and fine-grained programming process awareness and teaching decision support.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of online programming education, and in particular to a programming teaching method and system based on real-time bidirectional communication technology. Background Technology

[0002] With the continuous development of internet technology, online education has gradually become an important part of the education field. Online programming education, in particular, is attracting increasing attention from learners. Currently, mainstream online programming education platforms generally adopt a universal live-streaming classroom architecture, which is primarily based on audio and video live-streaming technology and used for teaching general subjects.

[0003] This general-purpose live-streaming classroom architecture mainly includes a basic interactive module and a static resource distribution mechanism. The basic interactive module provides functions such as text chat, raising hands to connect via voice chat, and screen sharing, aiming to promote communication between teachers and students; the static resource distribution mechanism involves uploading files such as PPT, PDF, and videos to a CDN (Content Delivery Network), which students can then download for learning.

[0004] However, in actual use, existing online programming education platforms have exposed many problems, seriously affecting teaching effectiveness and user experience:

[0005] Fragmented programming environment disrupts teaching continuity: Existing platforms lack embedded code editors and sandbox execution environments. This forces learners to manually switch to local tools for code writing and execution. This frequent switching disrupts the programming environment, undermines the continuity of the teaching process, makes it difficult for learners to maintain focus, and negatively impacts learning efficiency.

[0006] The lack of real-time interactive capabilities specific to programming: Teachers cannot send standardized task packages containing problems and compiler configurations with a single click; students can only manually paste their completed code into the chat box or submit it via email. This approach not only lacks real-time supervision but also relies excessively on teachers manually checking code, failing to achieve the real-time interaction required in programming education and reducing the timeliness and accuracy of teaching feedback.

[0007] Learning status perception blind spot: Because the platform fails to provide effective means for teachers to understand students' problem-solving ideas and real-time compilation error reports, teachers find it difficult to accurately grasp students' mastery of knowledge, thus failing to adjust the teaching pace in a timely manner. This results in a lack of targeted teaching and an inability to meet students' personalized learning needs. Summary of the Invention

[0008] To address at least one of the aforementioned technical problems, this application provides a programming teaching method and system based on real-time bidirectional communication technology.

[0009] Firstly, this application provides a programming teaching method based on real-time bidirectional communication technology, employing the following technical solution:

[0010] A programming teaching method based on real-time bidirectional communication technology includes the following steps:

[0011] It receives WebSocket connection requests initiated by clients and establishes secure connections, where clients include both teacher and student clients;

[0012] Based on the established connection, the system receives teaching instruction packets initiated by the teacher and sends them to the target student's end; it also receives feedback instruction packets initiated by the student and sends them to the target teacher's end.

[0013] Receive a disconnect request and delete the corresponding record in the strong association; the disconnect request is initiated by the client or detected by the server;

[0014] The teaching instruction package includes at least the instruction name, instruction content, user ID, classroom ID, target object, and instruction version; the data structure of the feedback instruction package is the same as that of the teaching instruction package.

[0015] In one embodiment: the step of receiving a WebSocket connection request initiated by the client and establishing a secure connection specifically includes:

[0016] Receive a WebSocket connection request initiated by a client, wherein the request header of the connection request carries an encrypted user authentication token;

[0017] Decrypt and parse the user authentication token, and verify whether the user authentication token is a valid token;

[0018] If the verification fails, the WebSocket connection will not be established, and a detailed error log will be recorded, including the source IP, the requested user authentication token, and the reason for the failure.

[0019] If the verification is successful, a long-lived WebSocket connection channel is established based on the WebSocket connection request.

[0020] The long connection channel is strongly associated with the key information parsed from the user authentication token; the key information includes user ID, role information and classroom ID.

[0021] The strongly associated data structure maintains a global, thread-safe connection session mapping table. The core structure of the mapping table is a mapping, where the key is designed to uniquely identify a user's connection in a classroom. The value of the mapping includes the object reference of the corresponding long connection channel, user ID, role information, and classroom ID.

[0022] In one embodiment: the user authentication token verification method includes the following steps in sequence:

[0023] Check the validity of the signature in the user authentication token and whether it is within the validity period;

[0024] Check if the role field in the user authentication token meets expectations;

[0025] Check whether the class exists in the user authentication token, and whether the user of the user authentication token belongs to the class.

[0026] In one embodiment: the steps of receiving a teaching instruction packet initiated by the teacher and sending it to the target student's end based on the established connection, and receiving a feedback instruction packet initiated by the student's end and sending it to the target teacher's end specifically include:

[0027] Obtain the teaching instruction packet sent by the teacher;

[0028] Parse the teaching instruction packet and verify whether the user ID obtained by parsing is a teacher based on the mapping table; if so, push the teaching instruction packet to the long connection channel corresponding to the target efficiently and concurrently based on the target object obtained after parsing and the mapping table.

[0029] Obtain feedback instruction packets from the student's end;

[0030] The feedback instruction packet is parsed, and the target object obtained after parsing is used to push the feedback instruction packet to the long connection channel corresponding to the target based on the mapping table.

[0031] In one embodiment: the programming teaching method further includes: after sending an instruction, monitoring the sending status of the instruction, storing the failed instruction and its metadata in a persistent retry queue, and resending the failed instruction based on the preset rules of the retry queue;

[0032] The metadata includes the current number of retries and the priority level identifier;

[0033] The preset rules include instruction priority and retry strategy, and the retry strategy of the queue to be retried is configured differently according to the instruction priority.

[0034] In one embodiment, the step of resending the failure instruction based on the preset rules of the retry queue specifically includes:

[0035] Start one or more background scheduled tasks to scan the waiting queue;

[0036] The time point for the next retry is calculated based on the retry level of the instruction and the current number of retries. When the instruction reaches the retry time point, the background scheduled task tries to send the instruction again.

[0037] If the transmission is successful, remove the instruction from the retry queue;

[0038] If the transmission fails, update the metadata of the instruction and put it back into the retry queue to wait for the next retry;

[0039] When the number of retries for an instruction reaches the maximum number of retries set for its priority level, it is removed from the retry queue and no further retries are performed. A detailed failure log is recorded and the instruction is marked as a final delivery failure. The failure log includes the instruction content, target, reason for failure, and retry history.

[0040] When an instruction is marked as a final delivery failure, a notification message is sent to the client that received the instruction.

[0041] In one embodiment: the programming teaching method further includes a reconnection mechanism based on an exponential backoff algorithm between the server and the client, the reconnection mechanism specifically including:

[0042] When the client detects that the WebSocket connection is broken, it immediately makes its first reconnection attempt.

[0043] If the first attempt fails, the interval between subsequent reconnection attempts will be calculated using any of the following formulas: Current latency = * ;

[0044] Current delay = * * (1 + jitter * (random() * 2 - 1));

[0045] In the formula, This refers to the initial delay, 'a' is the backoff factor, 'e' is the current number of retries, 'jitter' is a coefficient between 0 and 1, and 'random()' generates a random number between 0 and 1.

[0046] The reconnection process terminates when the connection is successfully established, the preset maximum number of reconnections is reached, or the client actively cancels the reconnection.

[0047] Secondly, this application provides a programming teaching method based on real-time bidirectional communication technology, which adopts the following technical solution:

[0048] A programming teaching method based on real-time bidirectional communication technology includes the following steps:

[0049] The teacher initiates the class by sending a WebSocket connection request to the server from the teacher's end.

[0050] Teachers can create teaching instructions and encapsulate them into structured and standardized teaching instruction packages. These teaching instructions include tasks such as question assignment, code editing, document display, screen sharing start / stop, and voice control. Each teaching instruction package includes the instruction name, instruction content, user ID, classroom ID, target object, and instruction version.

[0051] Based on the connection established with the server, teaching instruction packets are sent to the server, and feedback instruction packets sent by the server are received.

[0052] Based on the connection established with the server, the received feedback instruction packets are parsed, rendered, and then visualized to present the student's learning progress; wherein, the feedback instruction packets represent the status and results of the student's interactive operations based on the teaching instruction packets;

[0053] When the teaching instruction packet fails to be sent, receive the prompt message sent by the server.

[0054] Thirdly, this application provides a programming teaching method based on real-time bidirectional communication technology, which adopts the following technical solution:

[0055] A programming teaching method based on real-time bidirectional communication technology is characterized by including the following steps:

[0056] Students enter the classroom by sending a WebSocket connection request to the server from their client.

[0057] Based on the established connection with the server, the system receives teaching instruction packets sent by the server; the teaching instruction packet includes instruction name, instruction content, user ID, classroom ID, target object, and instruction version;

[0058] The teaching instruction package is parsed to obtain the instruction name and instruction content, and local operations are triggered. The local operations include requesting question details from the data storage module, rendering the integrated editor window in the browser to display the programming question, starting the screen sharing function, and receiving the video stream from the teacher's end.

[0059] Interactive operations are based on teaching instruction packages, and the status and results of interactive operations are encapsulated into feedback instruction packages. The status and results of interactive operations include submitting answers to programming questions, running code results, sending text messages, generating automated test reports, editing code, and requesting to speak via voice. The data structure of the feedback instruction package is the same as that of the teaching instruction package.

[0060] Based on the established connection with the server, the feedback instruction packet is sent to the server;

[0061] When the feedback instruction packet fails to be sent, receive the prompt message sent by the server.

[0062] Fourthly, this application provides a programming teaching system based on real-time bidirectional communication technology, which adopts the following technical solution:

[0063] A programming teaching system based on real-time bidirectional communication technology includes:

[0064] The teacher's side is used to establish a WebSocket connection with the server to initiate a class, send teaching instruction packets to the target student's end through the server, receive feedback instruction packets sent from the server, and visualize the feedback instruction packets.

[0065] The student's end is used to establish a WebSocket connection with the server, receive teaching instruction packets from the server, and trigger corresponding local operations; based on the teaching instruction packets, the student performs interactive operations to generate feedback instruction packets, and sends the feedback instruction packets to the teacher's end through the server;

[0066] The server-side includes a data storage module and a WebSocket communication service module based on the Netty framework. The data storage module is used to store static data and interactive data; the WebSocket communication service module is used to establish connections with student and teacher terminals and realize data transmission between student and teacher terminals.

[0067] In summary, this application has the following beneficial effects:

[0068] 1. Programming-driven, ultra-low-latency two-way interaction: Enables millisecond-level interaction between teachers and students centered around code. Key features include real-time push of programming questions and online IDE environments to teachers, dynamic distribution of code examples / snippets, and precise start / stop of the code execution environment. Students can also receive timely feedback on code editing, trigger code execution, and submit their programming answers.

[0069] 2. Real-time closed loop of instructional programming content and execution feedback: The core elements of programming teaching, such as problem description, initial code skeleton, test case set, sandbox environment configuration, and code control commands, are encapsulated into standardized lightweight instructions, which are pushed to the student's integrated development environment (IDE) in real time and accurately through the WebSocket channel.

[0070] At the same time, timely capture and feedback of students' core programming behaviors, especially the daily standard output of code sandbox execution results, compilation / runtime errors, debugging information, resource consumption, etc., automated test reports such as test case pass rate, detailed error information, etc., and the final submitted answer code;

[0071] 3. Fine-grained Programming Process Awareness and Teaching Decision Support: During students' programming practice, the system collects and analyzes their programming behavior data streams in real time, such as code editing frequency and patterns, number and results of running / debugging attempts, frequency of specific error types such as syntax, logic, and runtime errors, test case pass rates, and time spent answering questions. This data is visualized through the teacher's interface, enabling teachers to gain real-time insight into the depth of understanding and practical obstacles of all students in the class regarding the current programming knowledge points. The system can accurately identify groups of students who are struggling or have common error patterns. Based on real and dynamic programming process data, the system can adjust the teaching pace and content in real time, such as providing targeted explanations of common errors, pushing auxiliary code snippets, and adjusting the difficulty of questions. This significantly improves the efficiency and effectiveness of programming teaching and reduces the learning frustration caused by delayed feedback. Attached Figure Description

[0072] Figure 1 A flowchart illustrating a programming teaching method based on real-time bidirectional communication technology as one embodiment;

[0073] Figure 2 A flowchart of a programming teaching method based on real-time two-way communication technology on the teacher's end, provided as another embodiment;

[0074] Figure 3 A flowchart of a programming teaching method based on real-time two-way communication technology on the student side, as one embodiment;

[0075] Figure 4 A logic block diagram of a programming teaching system based on real-time bidirectional communication technology is provided as an embodiment.

[0076] In the diagram, 10 represents the teacher's end; 20 represents the student's end; 30 represents the WebSocket communication service module; and 40 represents the data storage module. Detailed Implementation

[0077] The present application will be further described in detail below with reference to the accompanying drawings.

[0078] To better understand the purpose, technical solutions, and advantages of this application, it has been described and illustrated below with reference to the accompanying drawings and embodiments. However, those skilled in the art should understand that this application can be implemented without these details. In some cases, to avoid obscuring various aspects of this application due to unnecessary description, well-known methods, processes, systems, components, and / or circuits already described at a higher level will not be elaborated upon. It will be apparent to those skilled in the art that various modifications can be made to the embodiments disclosed in this application, and the general principles defined in this application can be applied to other embodiments and application scenarios without departing from the principles and scope of this application. Therefore, this application is not limited to the illustrated embodiments, but conforms to the broadest scope consistent with the scope of protection claimed in this application.

[0079] It should be noted that the descriptions of these embodiments are for the purpose of aiding understanding the present invention, but do not constitute a limitation thereof. Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0080] In the description of this application, "several" means one or more, "more than" means two or more, "greater than," "less than," and "exceeding" are understood to exclude the stated number, while "above," "below," and "within" are understood to include the stated number. The use of "first" and "second" in the description is merely for distinguishing technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or implicitly indicating the order of the indicated technical features.

[0081] In the description of this application, the terms "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples.

[0082] like Figure 1 As shown, a programming teaching method based on real-time bidirectional communication technology includes the following steps:

[0083] S100: Receive a websocket connection request initiated by a client and establish a secure connection. The client includes a teacher's client 10 and a student's client 20.

[0084] Establishing a secure connection in this step specifically includes the following steps:

[0085] The system receives a WebSocket connection request initiated by a client. The request header of this connection request carries an encrypted user authentication token, which includes a user ID, role information, and class ID. The role information includes both student and teacher information. Furthermore, in this embodiment, the request header refers to the specific information carried in the request message header of the connection request.

[0086] The user authentication token is decrypted and parsed, and its validity is verified. The verification method for the user authentication token includes the following steps: checking the validity of the signature in the user authentication token and whether it is within its validity period; checking whether the role field in the user authentication token matches expectations; checking whether the class exists in the user authentication token and whether the user of the user authentication token belongs to that class.

[0087] If verification fails, the establishment of a WebSocket connection is refused, and a detailed error log is recorded. The error log includes the source IP, the requested user authentication token, and the reason for failure. In this step, the error log is used for security auditing and troubleshooting.

[0088] If the verification is successful, a long-lived WebSocket connection is established based on the WebSocket connection request; however, the verification is considered successful only if all three verification steps in the verification method pass.

[0089] The long connection channel is strongly associated with the key information parsed from the user authentication token; the key information includes user ID, role information, and class ID.

[0090] The strongly associated data structure maintains a global, thread-safe connection session mapping table. The core structure of this mapping table is a mapping where the key is designed to uniquely identify a user's connection within a classroom. In this embodiment, the key is a string combining the classroom ID and the user ID. The mapping value includes the corresponding long-lived connection channel object reference, user ID, role information, and classroom ID.

[0091] For example, let's take teacher T123 establishing a connection in classroom C1001. The key is C1001:T123, and the value is:

[0092] {channel:channel,useId:T123,role:teacher,classroomId:C1001}.

[0093] If student S456 establishes a connection in classroom C1001, the key will be C1001:S456, and the value will be:

[0094] {channel:channel,useId:S456,role:student,classroomId:C1001}.

[0095] S200: Based on the established connection, receive a teaching instruction packet initiated by the teacher terminal 10 and send it to the target student terminal 20; and receive a feedback instruction packet initiated by the student terminal 20 and send it to the target teacher terminal 10.

[0096] This step specifically includes:

[0097] Obtain the teaching instruction packet sent by the teacher terminal 10; parse the teaching instruction packet and verify whether the user ID obtained by parsing is a teacher based on the mapping table; if so, efficiently and concurrently push the teaching instruction packet to the long connection channel corresponding to the target through the target object obtained after parsing based on the mapping table.

[0098] Obtain the feedback instruction packet from student client 20; parse the feedback instruction packet, and based on the target object obtained after parsing, push the feedback instruction packet to the long connection channel corresponding to the target according to the mapping table.

[0099] In this embodiment, teaching instructions are initiated by the teacher's terminal 10, and include instructions such as pushing questions, editing code, displaying documents, starting / stopping screen sharing, voice control, text messages, and taking attendance. The teaching instructions are encapsulated in the teacher's terminal 10 to form a teaching instruction package, which includes at least the instruction name, instruction content, user ID, classroom ID, target object, and instruction version.

[0100] When verifying whether a user ID belongs to a teacher, the system compares the user ID, role information, and channel information stored in the mapping table for that classroom with the parsed user ID to verify if the corresponding role information belongs to a teacher. This step is set up to prevent malicious clients from forging teacher commands.

[0101] Preferably, the data structure of the feedback instruction package is the same as that of the teaching instruction package.

[0102] S300: Receive a disconnection request and delete the corresponding record in the strong association; the disconnection request is initiated by the client or detected by the server.

[0103] In this step, the disconnection request is mainly initiated by the client, or detected by the server due to the client going offline or shutting down.

[0104] In one embodiment, the programming teaching method further includes the following steps:

[0105] After sending the instruction, the sending status of the instruction is monitored, and the failed instruction and its metadata are stored in a persistent retry queue. The failed instruction is then resent based on the preset rules of the retry queue.

[0106] The instructions mentioned in the above steps refer to the feedback instruction packets and teaching instruction packets sent by the webocket communication module.

[0107] The main purpose of this step is to strictly monitor the sending status of the command packet. If the channel returns a success status asynchronously, the command has been successfully sent, and a successful sending log is recorded. If the channel is detected to be unwritable or an exception is thrown, the sending has failed.

[0108] In addition, the metadata includes the current number of retries and the priority level identifier. The preset rules include instruction priority and retry policy. The retry policy of the queue to be retried is configured differently according to the instruction priority. The retry policy includes the initial interval, backoff factor and maximum number of times.

[0109] In this embodiment, high priority is given to real-time interactive commands with high timeliness requirements, such as starting class, ending class, and mandatory collection of papers; medium priority is given to commands such as answer feedback and screen sharing; and low priority is given to commands such as non-critical status synchronization and log commands.

[0110] For retry strategies, higher-priority instructions are preferred to use shorter initial intervals, larger backoff factors, and more retry attempts. Alternatively, exponential backoff can also be used to calculate the retry interval, but the parameters are set according to priority level.

[0111] Furthermore, in this embodiment, the step of resending the failure instruction based on the preset rules of the retry queue specifically includes:

[0112] Start one or more background scheduled tasks to scan the waiting queue;

[0113] The time point for the next retry is calculated based on the retry level of the instruction and the current number of retries. When the instruction reaches the retry time point, the background scheduled task tries to send the instruction again.

[0114] If the transmission is successful, the instruction is removed from the retry queue.

[0115] If the transmission fails, update the metadata of the instruction and put it back into the retry queue to wait for the next retry;

[0116] When the number of retries for an instruction reaches the maximum number of retries set for its priority level, it is removed from the retry queue and no further retries are performed. A detailed failure log is recorded and the instruction is marked as a final delivery failure. The failure log includes the instruction content, target, reason for failure, and retry history.

[0117] When an instruction is marked as a final delivery failure, a notification message is sent to the client that received the instruction.

[0118] In another embodiment, the programming teaching method further includes a reconnection mechanism based on an exponential backoff algorithm between the server and the client.

[0119] The reconnection mechanism specifically includes:

[0120] When the client detects that the WebSocket connection is broken, it immediately makes its first reconnection attempt.

[0121] If the first attempt fails, the interval between subsequent reconnection attempts will be calculated using any of the following formulas: Current latency = * ;

[0122] Current delay = * * (1 + jitter * (random() * 2 - 1));

[0123] In the formula, This refers to the initial delay, 'a' is the backoff factor, 'e' is the current number of retries, 'jitter' is a coefficient between 0 and 1, and 'random()' generates a random number between 0 and 1.

[0124] The reconnection process terminates when the connection is successfully established, the preset maximum number of reconnections is reached, or the client actively cancels the reconnection.

[0125] In this embodiment, Formula 2 is preferred for calculation. This formula introduces jitter, which is mainly intended to prevent multiple clients from disconnecting at the same time and reconnecting at the same interval, causing a sudden surge in server load. A random jitter value is added to the calculated base interval.

[0126] This embodiment employs an end-to-end enhancement architecture designed for weak network environments, systematically designing a mechanism that combines automatic client reconnection with reliable server command delivery. The key to this embodiment lies in embedding the retry logic into the core layer of the communication module, rather than simply handling it at the application layer.

[0127] like Figure 2 As shown, another embodiment discloses a programming teaching method based on real-time bidirectional communication technology, including the following steps:

[0128] S101. Send a WebSocket connection request to the server through the teacher's end 10 to initiate the class.

[0129] S201. Create teaching instructions through the teacher's end 10 and encapsulate the teaching instructions into a structured and standardized teaching instruction package; wherein, the teaching instructions include question push, code editing, document display, screen sharing start / stop, and voice control; the teaching instruction package includes instruction name, instruction content, user ID, classroom ID, target object, and instruction version.

[0130] S301. Based on the connection established with the server, send teaching instruction packets to the server and receive feedback instruction packets sent by the server.

[0131] S401. Based on the connection established with the server, the received feedback instruction packet is parsed, rendered, and then visualized to present the student's learning status; wherein, the feedback instruction packet represents the status and result of the student terminal 20's interactive operation based on the teaching instruction packet.

[0132] S501. When the teaching instruction packet fails to be sent, receive the prompt message sent by the server.

[0133] In this embodiment, the client is a browser-based application that provides a teaching console interface. Functions include: initiating / managing classes, creating / sending teaching instructions, receiving real-time student feedback data, and visually presenting students' learning progress.

[0134] Specifically, it establishes a WebSocket connection with the server and uses a long-lived WebSocket connection for efficient data transmission. Core elements of programming instruction, such as problem descriptions, initial code skeletons, test case sets, sandbox environment configurations, and code control commands, are encapsulated into standardized, lightweight instructions, which are then pushed to the student's integrated development environment (IDE) in real-time and with precision via the WebSocket channel. This solves the problems of traditional teaching platforms, such as limited interaction methods, poor real-time performance, and complex state synchronization.

[0135] It also promptly captures and transmits feedback on the core programming behaviors of students, especially the daily standard output of code sandbox execution results, compilation / runtime errors, debugging information, resource consumption, etc., automated test reports such as test case pass rate, detailed error information, etc., and the final submitted answer code.

[0136] By rendering UI components and visualizing the information on the teacher's interface, teachers can gain real-time insight into the depth of understanding and practical obstacles of all students regarding the current programming knowledge points. They can accurately identify groups of students who are struggling or have common error patterns. Based on real and dynamic programming process data, teachers can adjust the teaching pace and content in real time, such as providing targeted explanations of common errors, pushing auxiliary code snippets, and adjusting the difficulty of questions. This significantly improves the efficiency and effectiveness of programming teaching and reduces the sense of frustration caused by delayed feedback.

[0137] like Figure 3 As shown, another embodiment discloses a programming teaching method based on real-time bidirectional communication technology, including the following steps:

[0138] S102. Students send a websocket connection request to the server to enter the classroom.

[0139] S202. Based on the connection established with the server, receive the teaching instruction packet sent by the server; wherein, the teaching instruction packet includes instruction name, instruction content, user ID, classroom ID, target object and instruction version;

[0140] S302. Parse the teaching instruction package to obtain the instruction name and instruction content, and trigger local operations; the local operations include requesting question details from the data storage module, rendering the integrated editor window in the browser to display the programming question, starting the screen sharing function, and receiving the video stream from the teacher's end;

[0141] S402. Conduct interactive operations based on the teaching instruction package, and encapsulate the status and results of the interactive operations into a feedback instruction package; wherein, the status and results of the interactive operations include submitting answers to programming questions, running code results, sending text messages, automated test reports, editing code, and requesting to speak via voice; the data structure of the feedback instruction package is the same as the data structure of the teaching instruction package;

[0142] S502. Based on the connection established with the server, send the feedback instruction packet to the server;

[0143] S602. When the feedback instruction packet fails to be sent, receive the prompt message sent by the server.

[0144] In this embodiment, the student client 20 is based on a browser or desktop application, providing a learning interface for students. Its functions include: receiving and rendering teaching instructions pushed by the teacher, performing interactive operations, and providing real-time feedback of operation results / status to the server.

[0145] Specifically, after receiving the teaching instruction package, the system transforms the structured data related to the programming questions into an interactive programming interface through local operations. Simultaneously, during student programming practice, the system collects and analyzes real-time data streams of their programming behavior, such as code editing frequency and patterns, number and results of run / debug attempts, frequency of specific error types (e.g., syntax, logic, runtime errors), test case pass / fail status, and time taken to answer questions.

[0146] like Figure 4 As shown, another embodiment discloses a programming teaching system based on real-time bidirectional communication technology, comprising:

[0147] Teacher terminal 10 is used to establish a WebSocket connection with the server to initiate a class, and to send teaching instruction packets to the target student terminal 20 through the server, receive feedback instruction packets sent from the server, and visualize the feedback instruction packets.

[0148] Student terminal 20 is used to establish a WebSocket connection with the server, receive teaching instruction packets from the server and trigger corresponding local operations; perform interactive operations based on the teaching instruction packets to form feedback instruction packets, and send the feedback instruction packets to teacher terminal 10 through the server.

[0149] The server includes a data storage module 40 and a Websocket communication service module 30 based on the Netty framework. The data storage module 40 is used to store static data and interactive data. The Websocket communication service module 30 is used to establish connections with the student terminal 20 and the teacher terminal 10 and to realize data transmission between the student terminal 20 and the teacher terminal 10.

[0150] By leveraging a high-performance, highly reliable communication engine based on Netty's asynchronous event-driven architecture, and employing a WebSocket communication core built with the Netty framework, the core fully utilizes Netty's Reactor thread model, enabling the management of massive concurrency with a small number of threads. Furthermore, all network operations, such as connection establishment, authentication, and command reading / writing, are asynchronous, avoiding thread blocking and significantly improving throughput and resource utilization.

[0151] The static data includes course outlines, question banks such as question IDs, question content, standard answers, knowledge point tags, compiler template configurations, and teaching materials. The interactive data includes classroom instance information, student answer records such as student IDs, question IDs, submitted answers / code, execution results, time taken, scores, timestamps, instruction logs such as those used for auditing and retries, and user connection status logs.

[0152] By configuring a WebSocket communication service module 30 based on the Netty framework, ultra-low latency bidirectional interaction driven by programming is achieved, enabling millisecond-level interaction between teachers and students centered around code. Key features include: teacher-side 10 real-time push of programming questions and online IDE environments, dynamic distribution of code examples / snippets, and precise start / stop of code execution environments; and student-side 20 timely feedback on code editing behavior, triggering code execution, and submitting programming answers.

[0153] The embodiments described in this specific implementation are preferred embodiments of this application and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.

Claims

1. A programming teaching method based on real-time bidirectional communication technology, characterized in that, The method comprises the following steps: receiving a websocket connection request initiated by a client and establishing a secure connection, wherein the client comprises a teacher end and a student end; based on the established connection, receiving a teaching instruction package initiated by the teacher end and sending it to the target student end, and receiving a feedback instruction package initiated by the student end and sending it to the target teacher end; receiving a disconnection request and deleting the corresponding record in the strong association; the disconnection request is initiated by the client or detected by the server; wherein the teaching instruction package at least includes instruction name, instruction content, user ID, classroom ID, target object and instruction version; the data structure of the feedback instruction package is the same as that of the teaching instruction package; the step of receiving a websocket connection request initiated by a client and establishing a secure connection specifically comprises: receiving a websocket connection request initiated by a client, wherein the request header of the connection request carries an encrypted user authentication token; decrypting and parsing the user authentication token and verifying whether the user authentication token is a valid token; if the verification fails, refuse to establish a websocket connection, and record detailed error logs, including source IP, requested user authentication token and failure reason; if the verification is successful, establish a websocket long connection channel based on the websocket connection request; strongly associate the long connection channel with the key information parsed from the user authentication token; the key information includes user ID, role information and classroom ID; wherein the data structure of strong association is to maintain a global and thread-safe connection session mapping table; the core structure of the mapping table is a mapping, and the key of the mapping is designed to uniquely identify a user's connection in a classroom; the value of the mapping includes the object reference of the corresponding long connection channel, user ID, role information and classroom ID; the verification method of the user authentication token comprises the following steps in turn: checking the validity of the signature in the user authentication token and whether it is within the valid period; checking whether the role field in the user authentication token meets the expectation; checking whether the classroom exists in the user authentication token and whether the user of the user authentication token belongs to the classroom.

2. The programming teaching method based on real-time bidirectional communication technology according to claim 1, characterized in that, based on the established connection, receiving a teaching instruction package initiated by the teacher end and sending it to the target student end; and receiving a feedback instruction package initiated by the student end and sending it to the target teacher end, specifically comprising: obtaining the teaching instruction package sent by the teacher end; parsing the teaching instruction package and verifying whether the user ID obtained by parsing is a teacher based on the mapping table; if yes, based on the mapping table, the teaching instruction package is pushed to the target corresponding long connection channel through the target object obtained after parsing; obtaining the feedback instruction package of the student end; parsing the feedback instruction package and pushing the feedback instruction package to the target corresponding long connection channel through the target object obtained after parsing based on the mapping table.

3. The programming teaching method based on real-time bidirectional communication technology according to claim 1, characterized in that, The programming teaching method further comprises: after sending the instruction, monitoring the sending state of the instruction, and storing the failed instruction and its metadata into a persistent retry queue; and resending the failed instruction based on preset rules of the retry queue. The metadata comprises a current retry number and a priority level identifier. The preset rules comprise an instruction priority and a retry strategy, and the retry strategy of the retry queue is configured differently according to the instruction priority.

4. The programming teaching method based on real-time bidirectional communication technology according to claim 3, characterized in that, The step of resending the failed instruction based on the preset rules of the retry queue specifically comprises: starting one or more background timing tasks to scan the waiting queue; calculating a next retry time point according to the retry level of the instruction and the current retry number, and attempting to resend the instruction again by the background timing task when the instruction reaches the retry time point; if the sending is successful, removing the instruction from the retry queue; if the sending fails, updating the metadata of the instruction and putting it back into the retry queue for next retry; when the retry number of the instruction reaches the maximum retry number set according to the priority level, removing the instruction from the retry queue, not retrying, and recording detailed failure logs and marking as final delivery failure, wherein the failure logs comprise instruction content, target, failure reason, and retry history; when the instruction is marked as final delivery failure, sending prompt information to the client receiving the instruction.

5. The programming teaching method based on real-time bidirectional communication technology according to claim 1, characterized in that, The programming teaching method further comprises a reconnection mechanism based on an exponential backoff algorithm between the server and the client, and the reconnection mechanism specifically comprises: when the client listens to the disconnection state of the websocket connection, immediately attempting the first reconnection; If the first attempt fails, the interval between subsequent reconnection attempts is calculated according to either of the following formulas: current delay = min (current delay + 1, 60) or current delay = min (current delay + 1, 120). ;​ current delay = current delay + (1 + jitter * (random() * 2 - 1)); current delay = current delay + (1 + jitter * (random() * 2 - 1));​ wherein denotes the initial delay, a denotes the back-off factor, e denotes the current number of retries, jitter is a factor between 0 and 1, and random() generates a random number between 0 and 1; when the connection is successfully established, the maximum number of preset reconnections is reached, or the client actively cancels the reconnection, terminating the reconnection.

6. A programming teaching method based on real-time bidirectional communication technology, characterized in that, The steps comprise: sending a websocket connection request to the server through the teacher end to initiate a class, to establish a secure connection; creating a teaching instruction through the teacher end, and encapsulating the teaching instruction into a structured and standardized teaching instruction package; wherein the teaching instruction comprises question pushing, code editing, document display, screen sharing start / stop, and voice control; and the teaching instruction package comprises instruction name, instruction content, user ID, class ID, target object, and instruction version; sending the teaching instruction package to the server based on the secure connection established with the server, and receiving a feedback instruction package sent by the server; based on the secure connection established with the server, analyzing the received feedback instruction package, and rendering and visualizing the learning situation of the students; wherein the feedback instruction package represents the state and result of the interactive operation of the student end based on the teaching instruction package; when the teaching instruction package fails to be sent, receiving prompt information sent by the server; The step of establishing a secure connection specifically comprises: initiating a websocket connection request through the teacher end, wherein the request header of the connection request carries an encrypted user authentication token; decrypting and analyzing the user authentication token by the server, and verifying whether the user authentication token is a valid token; If the verification fails, the websocket connection is rejected, and detailed error logs are recorded, including the source IP, the requested user authentication token, and the failure reason. If the verification succeeds, a websocket long connection channel is established based on the websocket connection request. The server strongly associates the long connection channel with the key information parsed from the user authentication token, including the user ID, role information, and classroom ID. The data structure of the strong association is a global, thread-safe connection session mapping table. The core structure of the mapping table is a mapping, and the key of the mapping is designed to uniquely identify a user's connection in a classroom. The value of the mapping includes the object reference of the corresponding long connection channel, the user ID, the role information, and the classroom ID. The user authentication token verification method includes the following steps: Check the validity of the signature in the user authentication token and whether it is within the valid period. Check whether the role field in the user authentication token meets the expected requirements. Check whether the classroom exists in the user authentication token and whether the user of the user authentication token belongs to the classroom.

7. A programming teaching method based on real-time bidirectional communication technology, characterized in that, The steps include: Send a websocket connection request to the server from the student end to enter the classroom to establish a secure connection. Based on the secure connection established with the server, receive the teaching instruction package sent by the server; wherein the teaching instruction package includes instruction name, instruction content, user ID, classroom ID, target object, and instruction version. Parse the teaching instruction package to obtain the instruction name and instruction content, and trigger the local operation; the local operation includes requesting the topic details from the data storage module, rendering the integrated editor window in the browser to display the programming topic, starting the screen sharing function, and receiving the video stream from the teacher end. Based on the teaching instruction package, perform interactive operations and encapsulate the status and results of the interactive operations as a feedback instruction package; wherein the status and results of the interactive operations include submitting the programming answer, running the code result, sending text messages, automatic testing reports, editing codes, and voice application for speaking; the data structure of the feedback instruction package is the same as that of the teaching instruction package. Based on the secure connection established with the server, send the feedback instruction package to the server. When the feedback instruction package fails to be sent, receive the prompt information sent by the server. The step of establishing a secure connection includes: Initiate a websocket connection request from the student end to the server, wherein the request header of the connection request carries an encrypted user authentication token. The server decrypts and parses the user authentication token and verifies whether the user authentication token is a valid token. If the verification fails, the websocket connection is rejected, and detailed error logs are recorded, including the source IP, the requested user authentication token, and the failure reason. If the verification succeeds, a websocket long connection channel is established based on the websocket connection request. The server strongly associates the long connection channel with the key information parsed from the user authentication token; the key information includes user ID, role information and class ID; The data structure of the strong association is to maintain a global and thread-safe connection session mapping table; the core structure of the mapping table is a mapping, and the key of the mapping is designed to uniquely identify a user's connection in a class; the value of the mapping includes the object reference of the corresponding long connection channel, user ID, role information and class ID; The verification method of the user authentication token includes the following steps in sequence: Check the validity of the signature in the user authentication token and whether it is within the valid period; Check whether the role field in the user authentication token meets the expectation; Check whether the class in the user authentication token exists, and whether the user of the user authentication token belongs to the class.

8. A programming education system based on real-time bidirectional communication technology for implementing the programming education method based on real-time bidirectional communication technology according to claim 1, characterized in that, It includes: The teacher end (10) is used to establish websocket connection with the server to initiate the class, and send the teaching instruction package to the target corresponding student end (20) through the server, receive the feedback instruction package sent from the server, and visually present the feedback instruction package; The student end (20) is used to establish websocket connection with the server, receive the teaching instruction package through the server, and trigger the corresponding local operation; interactive operation based on the teaching instruction package forms a feedback instruction package, and the feedback instruction package is sent to the teacher end (10) through the server; The server includes a data storage module (40) and a websocket communication service module (30) based on Netty framework; the data storage module (40) is used to store static data and interactive data; the websocket communication service module (30) is used to establish connection with the student end (20) and the teacher end (10), and realize data transmission between the student end (20) and the teacher end (10).

Citation Information

Patent Citations

  • Server and client instant messaging method for realizing training simulation

    CN111245705A

  • Data transfer method, device and system

    CN113518105A

  • Cross-device real-time dynamic grouping adjustment system

    CN120768652A

  • Device control method, apparatus, system, electronic device and cloud server

    WO2020168571A1