Development debugging environment switching method, device, equipment, medium and product

By adding code snippets and the WebSocket protocol to the browser client, automatic environment switching between the browser and the server is achieved, solving the problems of inconvenience and inefficiency in switching development and debugging environments, and improving development efficiency and security.

CN121614409APending Publication Date: 2026-03-06BEIJING JINGDONG YUANSHENG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411189518.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-27
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

Existing technologies are inconvenient and inefficient when switching development and debugging environments, especially when frequently manually adjusting configuration files and switching between browsers and development tools, resulting in a poor development experience and security risks.

Method used

Add code snippets to the browser client to establish a communication connection with the server using the WebSocket protocol, and use a monitoring mechanism to detect communication connection events to achieve automatic transmission of environment code and switching of the server environment.

Benefits of technology

By simplifying the interaction process between the browser and the server, the convenience and efficiency of switching between development and debugging environments are improved, debugging costs are reduced, and security risks of offline code are avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121614409A_ABST
    Figure CN121614409A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a development debugging environment switching method, device and equipment, a medium and a product. The method comprises the steps that code snippets are added into packaged environment codes, the environment codes correspond to a target development debugging environment, and the code snippets are configured to enable a browser client and a server to establish communication connection; adding a monitoring mechanism about the communication connection event to the code snippet, wherein the monitoring mechanism comprises trigger monitoring which is associated with the browser client and aims at the communication connection event and transmission monitoring which is associated with the server and aims at the communication connection event; and in response to triggering of the communication connection event detected by the browser client, transmitting the environment code to the server through the communication connection, so that the server switches the current development debugging environment to the target development debugging environment based on a monitoring result of the communication connection event and the received environment code.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The exemplary embodiments disclosed herein generally relate to the field of computers, and particularly to methods, apparatus, devices, computer-readable storage media, and computer program products for developing and debugging environment switching. Background Technology

[0002] Currently, when developing and debugging the front-end, developers start the front-end project locally and interact with the back-end by sending network requests. In some scenarios, developers may need to switch the current environment for accessing the back-end to verify certain functions, or they may be processing issues in parallel and need to monitor the front-end performance under different environments. In these cases, developers need to switch the startup environment of their local project. Therefore, it is desirable to make switching development and debugging environments more convenient and efficient. Summary of the Invention

[0003] In a first aspect of this disclosure, a method for switching development and debugging environments is provided. The method is implemented at a browser client and includes: adding a code snippet to packaged environment code, the environment code corresponding to a target development and debugging environment, the code snippet being configured to enable the browser client to establish a communication connection with a server; adding a monitoring mechanism for communication connection events to the code snippet, the monitoring mechanism including trigger monitoring of communication connection events associated with the browser client and transmission monitoring of communication connection events associated with the server; and in response to detecting a trigger of a communication connection event via the browser client, transmitting the environment code to the server via the communication connection, so that the server switches the current development and debugging environment to the target development and debugging environment based on the monitoring result of the communication connection event and the received environment code.

[0004] In a second aspect of this disclosure, a method for switching development and debugging environments is provided. The method is implemented on a server and includes: monitoring the transmission of a communication connection event by a browser client, the communication connection event causing the browser client to establish a communication connection with the server; in response to detecting the communication connection event transmitted by the browser client, receiving packaged environment code from the browser client; and based on the environment code, switching the current development and debugging environment on the server to a target development and debugging environment corresponding to the environment code.

[0005] In a third aspect of this disclosure, an apparatus for switching development and debugging environments is provided. The apparatus includes: a code snippet adding module configured to add a code snippet to packaged environment code at a browser client, the environment code corresponding to a target development and debugging environment, the code snippet being configured to establish a communication connection between the browser client and a server; a monitoring mechanism adding module configured to add a monitoring mechanism for communication connection events to the code snippet, the monitoring mechanism including trigger monitoring of communication connection events associated with the browser client and transmission monitoring of communication connection events associated with the server; and a transmission module configured to transmit the environment code to the server via the communication connection in response to the detection of a triggering of a communication connection event by the browser client, so that the server switches the current development and debugging environment to the target development and debugging environment based on the monitoring result of the communication connection event and the received environment code.

[0006] In a fourth aspect of this disclosure, an apparatus for switching development and debugging environments is provided. The apparatus includes: a monitoring module configured to monitor the transmission of communication connection events by a browser client, the communication connection events causing the browser client to establish a communication connection with a server; a receiving module configured to receive packaged environment code from the browser client in response to detecting the communication connection event transmitted by the browser client; and a switching module configured to switch the current development and debugging environment at the server to a target development and debugging environment corresponding to the environment code, based on the environment code.

[0007] In a fifth aspect of this disclosure, an electronic device is provided. The electronic device includes at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions causing the electronic device to perform the methods of the first or second aspect of this disclosure when executed by the at least one processing unit.

[0008] In a sixth aspect of this disclosure, a computer-readable storage medium is provided. This computer-readable storage medium stores a computer program that can be executed by a processor to perform the method according to the first or second aspect of this disclosure.

[0009] In a seventh aspect of this disclosure, a computer program product is provided. The computer program product is tangibly stored in a computer storage medium and includes computer-executable instructions that, when executed by a device, cause the device to perform the method of the first or second aspect.

[0010] It should be understood that the description in the Summary of the Invention section is not intended to limit the key or essential features of the embodiments of this disclosure, nor is it intended to restrict the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0011] The above and other features, advantages, and aspects of various implementations of this disclosure will become more apparent in the following detailed description, taken in conjunction with the accompanying drawings. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein:

[0012] Figure 1 A schematic diagram of an example environment in which embodiments of the present disclosure can be implemented is shown;

[0013] Figure 2 A flowchart illustrating the process of switching development and debugging environments according to a traditional approach is shown.

[0014] Figure 3 A flowchart illustrating a process for switching development and debugging environments according to some embodiments of this disclosure is shown;

[0015] Figure 4 A flowchart illustrating a process for switching development and debugging environments according to some embodiments of this disclosure is shown;

[0016] Figure 5 A flowchart illustrating a process for switching development and debugging environments according to some embodiments of this disclosure is shown;

[0017] Figure 6 A flowchart illustrating a process for switching development and debugging environments according to some embodiments of this disclosure is shown;

[0018] Figure 7 A block diagram of an apparatus for switching development and debugging environments according to some embodiments of the present disclosure is shown;

[0019] Figure 8 A block diagram of an apparatus for switching development and debugging environments according to some embodiments of the present disclosure is shown; and

[0020] Figure 9 A block diagram of an electronic device in which one or more embodiments of the present disclosure may be implemented is shown. Detailed Implementation

[0021] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0022] In the description of embodiments of this disclosure, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may also be included below.

[0023] In this document, unless explicitly stated otherwise, performing a step in response to A does not mean that the step is performed immediately after A, but may include one or more intermediate steps.

[0024] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition, use, storage or deletion of the data) shall comply with the requirements of relevant laws, regulations and related provisions.

[0025] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, relevant users should be informed of the type, scope of use, and usage scenarios of the information involved in this disclosure through appropriate means in accordance with relevant laws and regulations, and authorization should be obtained from the relevant users. Among them, relevant users may include any type of rights holder, such as individuals, enterprises, and groups.

[0026] For example, in response to receiving an active request from a user, a prompt message is sent to the relevant user to clearly inform the user that the requested operation will require obtaining and using the user's information, thereby enabling the relevant user to choose whether to provide information to the software or hardware such as the electronic device, application, server, or storage medium that performs the operation of the technical solution disclosed herein based on the prompt message.

[0027] As an optional but non-restrictive implementation, in response to a user's active request, a prompt message can be sent to the user, such as a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide information to the electronic device.

[0028] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure. The activation of digital assistant-related functions, the acquisition of data, the processing and storage of data, etc., in the embodiments of this disclosure shall all require prior authorization from the user and other rights holders associated with the user, and shall comply with the agreements and rules between relevant laws and regulations and rights holders.

[0029] Figure 1A schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented is shown. Environment 100 may include a browser client 110 and a server 120. The browser client 110 may establish a communication connection with the server 120, thereby enabling switching between development and debugging environments.

[0030] Browser client 110 can be configured on a terminal device. The terminal device can be any type of mobile terminal, fixed terminal, or portable terminal, including mobile phones, desktop computers, laptop computers, notebook computers, netbook computers, tablet computers, media computers, multimedia tablets, personal communication system (PCS) devices, or any combination thereof, including accessories and peripherals of these devices, or any combination thereof.

[0031] In some embodiments, server 120 may include, for example, a computing system / server, such as a mainframe, edge computing node, computing device in a cloud environment, etc. Server 120 may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks, and big data and artificial intelligence platforms. Server 120 may include, for example, a computing system / server, such as a mainframe, edge computing node, computing device in a cloud environment, etc.

[0032] It should be understood that the structure and function of environment 100 are described for illustrative purposes only and do not imply any limitation on the scope of this disclosure.

[0033] As briefly mentioned earlier, when developing and debugging the front-end, developers often interact with the back-end by sending network requests, typically distinguishing the interaction environment using a domain name. In some scenarios, developers may need to switch the current back-end environment for debugging. Currently, the main solutions for switching development and debugging environments are as follows:

[0034] 1) Runtime configuration: This solution adjusts the environment-related configuration at runtime, rather than during the project build process. This allows developers to adjust the project's configuration files during project execution and achieve dynamic environment switching by leveraging the hot update principle of the packaging tool, without needing to restart the local service.

[0035] However, runtime configuration schemes can lead to the configuration and code being packaged and deployed in offline environments, posing certain security risks. Furthermore, to switch environments, developers still need to manually adjust configuration files through the development tools, and the switching between browsers and development tools remains unavoidable, causing inconvenience and impacting the development experience.

[0036] 2) Manual switching: Since the current startup environment is determined when the project is built, it cannot be adjusted during project operation. Therefore, developers must manually shut down and start the project to switch the current debugging environment.

[0037] Figure 2 A schematic diagram of a switching process 200 for a development and debugging environment according to a conventional approach is shown. Figure 2 As shown, in the traditional development and debugging environment scheme, the developer 210 determines the required development and debugging environment before the project runs, such as a certain environment in environment 220. Then, based on the determined environment, the local service 230 of the server 120 is developed and debugged. The results of the development and debugging are transmitted to the browser 240 of the browser client 110. The user 250 determines whether to switch environments (260) based on the development and debugging results displayed in the browser 240. If it is determined that an environment switch is needed, the developer 210 re-determines the required development and debugging environment. If no environment switch is needed, the process ends (270), and the current development and debugging environment is maintained.

[0038] In such situations, manually switching solutions requires repackaging, which wastes time when project packaging is lengthy and hinders development efficiency. Furthermore, developers cannot avoid the process of switching between browsers and development tools.

[0039] Therefore, it is hoped that switching between development and debugging environments can be more convenient and efficient.

[0040] According to embodiments of this disclosure, an improved scheme for switching development and debugging environments is proposed. At the browser client, a code snippet is added to the packaged environment code. The environment code corresponds to the target development and debugging environment, and the code snippet is configured to establish a communication connection between the browser client and the server. A monitoring mechanism for communication connection events is added to the code snippet. This monitoring mechanism includes trigger monitoring of communication connection events associated with the browser client and transmission monitoring of communication connection events associated with the server. In response to the detection of a triggering of a communication connection event via the browser client, the environment code is transmitted to the server via the communication connection, so that the server switches the current development and debugging environment to the target development and debugging environment based on the monitoring result of the communication connection event and the received environment code. At the server, the transmission of communication connection events by the browser client is monitored, and the communication connection events establish a communication connection between the browser client and the server. In response to the detection of a communication connection event transmitted by the browser client, the packaged environment code is received from the browser client. Based on the environment code, the current development and debugging environment at the server is switched to the target development and debugging environment corresponding to the environment code.

[0041] This approach enables interaction between the client's browser and the server's local services via a communication connection, avoiding the need for developers to frequently switch between development tools and browsers to restart the project. By injecting code snippets into the environment code and employing a monitoring mechanism, developers can directly switch development environments through the browser. This solution shortens and simplifies the process of switching development and debugging environments during debugging, thereby reducing debugging costs and improving development efficiency.

[0042] Figure 3 A flowchart of a process 300 for switching development and debugging environments according to some embodiments of the present disclosure is shown. Process 300 can be implemented in... Figure 1 The browser client is at point 110. For ease of discussion, references will be provided. Figure 1 The environment 100 is used to describe the process 300.

[0043] In box 310, browser client 110 adds a code snippet to the packaged environment code, which corresponds to the target development and debugging environment. The code snippet is configured to enable browser client 110 to establish a communication connection with server 120. In some embodiments, the communication connection may include a communication connection based on the WebSocket communication protocol.

[0044] WebSocket is a computer communication protocol that provides a full-duplex communication channel over a single TCP (Transmission Control Protocol) connection. WebSocket simplifies data exchange between browser client 110 and server 120, allowing server 120 to proactively push data to browser client 110. In the WebSocket interface, browser client 110 and server 120 only need to complete a single handshake to establish a persistent connection and perform bidirectional data transmission.

[0045] In some embodiments, the packaging tools used to package the environment code include, but are not limited to, webpack (a code compilation tool) and vite (a next-generation front-end development and build tool).

[0046] In some embodiments, when adding code snippets to the packaged environment code, a bundling tool that performs the bundling of the environment code can be used to add the code snippets to the packaged environment code. For example, the aforementioned webpack and vite bundling tools can be used to add code snippets to the environment code to enable the browser client 110 to establish a communication connection with the server 120. These bundling tools have code injection capabilities and can inject code snippets. The purpose of the injected code snippets is to establish a WebSocket connection with the server 120. It should be noted that code injection can only occur during local development and debugging to avoid security issues. A corresponding code example is as follows:

[0047] const ws=new WebSocket('${wsPath}','${wsProtocol}')

[0048] function handleEnv(env){

[0049] ws.send(JSON.stringify({type:'custom',event:'${eventName}',data:{env}}))

[0050] }

[0051] In such a code example, the wsPath and wsProtocol parameters must be consistent with the created WebSocket to provide communication and interaction capabilities for the browser client 110 and the server 120.

[0052] In such an embodiment, by adding code snippets to the packaged environment code to enable the browser client 110 to establish a communication connection with the server 120, it is not only convenient to develop and debug locally on the server 120, but also facilitates hot updates.

[0053] In box 320, browser client 110 adds a monitoring mechanism for communication connection events to the code snippet. The monitoring mechanism includes trigger monitoring of communication connection events associated with browser client 110 and transmission monitoring of communication connection events associated with server 120. Here, the monitoring mechanism can also be referred to as a listening mechanism.

[0054] In some embodiments, adding an event listener to a WebSocket can be represented by the following code:

[0055] ws.on(eventName, async(payload) => { / *Restart service logic* / })

[0056] Here, ws is a WebSocket connection, eventName is the name of the event to be listened to, and payload is the data passed from the event trigger (browser client 110) to the event listener (server 120). When server 120 listens to the event specified by eventName, it will execute the local service restart process.

[0057] In box 330, if the browser client 110 detects the triggering of a communication connection event, the browser client 110 transmits the environment code to the server 120 through the communication connection, so that the server 120 switches the current development and debugging environment to the target development and debugging environment based on the listening result of the communication connection event and the received environment code.

[0058] For example, the triggering of the communication connection event can be initiated by the developer through browser client 110. Once browser client 110 detects the triggering of the communication connection event, it can transmit the environment code to server 120 through the communication connection. The process by which server 120 switches the current development and debugging environment to the target development and debugging environment based on the listening result of the communication connection event and the received environment code will be discussed in detail below.

[0059] In some embodiments, when the browser client 110 detects the triggering of a communication connection event and transmits environment code to the server 120 via the communication connection, the browser client 110 can detect the triggering of the communication connection event by detecting operations on preset controls on the browser. If the triggering of the communication connection event is detected, the browser client 110 can transmit the environment code to the server 120 via the communication connection.

[0060] In such an embodiment, to enable developers to switch operating environments on the browser side, relevant view controls can be added to the browser page, and corresponding event listeners can be added to these view controls. Such controls could be, for example, buttons. It should be understood that the default control can be any suitable type of control capable of triggering communication connection events.

[0061] For example, operations on preset controls in a browser can be, for instance, clicks. In other embodiments, such operations can also be long presses, swipes, etc., and are not limited here.

[0062] Taking a button as the default control as an example, we can add corresponding independent buttons to the browser for each environment, and add click event listener logic to each button. When the developer clicks the button, the defined `handleEnv` function is triggered, sending a message to server 120. Assuming the defined `pro` button corresponds to the test environment, when the developer clicks the `pro` button, the browser will send the parameters (payload) required for the `pro` environment to server 120 via a WebSocket connection. Server 120 will then restart its local service based on these parameters, thus achieving environment switching.

[0063] The embodiments disclosed herein enable interaction between a browser and a local service based on WebSocket, avoiding the need for developers to frequently switch between development tools and browsers and restart the project. Furthermore, by injecting code snippets into the project source code, an environment switching button function is implemented, allowing developers to switch development environments directly through the browser.

[0064] Figure 4 A flowchart of a process 400 for switching development and debugging environments according to some embodiments of the present disclosure is shown. Process 400 can be implemented in... Figure 1 There are 120 server-side components. For ease of discussion, references will be provided. Figure 1 The environment 100 is used to describe the process 400.

[0065] In box 410, server 120 monitors the transmission of communication connection events by browser client 110, which enables browser client 110 to establish a communication connection with server 120. Such monitoring can be based on the monitoring mechanism described above. In some embodiments, the communication connection may include a communication connection based on the WebSocket communication protocol.

[0066] In box 420, if a communication connection event transmitted by browser client 110 is detected, server 120 receives packaged environment code from browser client 110. In some embodiments, environment code may include, but is not limited to, code for a test environment, code for a production environment, code for a pre-production environment, etc.

[0067] In box 430, server 120 switches the current development and debugging environment at server 120 to the target development and debugging environment corresponding to the environment code based on the environment code. In some embodiments, the target development and debugging environment may be, for example, a test environment, a production environment, a pre-production environment, etc.

[0068] In some embodiments, the environment code may include environment description information. When switching the current development and debugging environment at server 120 to the target development and debugging environment corresponding to the environment code, server 120 may determine whether the environment description information matches the target development and debugging environment. If the environment description information matches the target development and debugging environment, server 120 may switch its current development and debugging environment to the target development and debugging environment corresponding to the environment code.

[0069] For example, the `handleEnv` function of the environment code can be used to send browser-triggered events and the necessary information, such as the description information `env` of the environment to be switched. In such an embodiment, by determining whether the environment description information matches the target development and debugging environment, the accuracy and effectiveness of the environment switching can be ensured.

[0070] In some embodiments, the environment code may include operation parameters for the server 120. When switching the current development and debugging environment at the server 120 to the target development and debugging environment corresponding to the environment code, the server 120 may determine its operation requirements for the local service based on the operation parameters. Then, the server 120 may perform the corresponding operation on the local service based on the operation requirements.

[0071] In some embodiments, the operational requirements may include at least the requirement to perform a restart operation on the local service. Accordingly, the operation performed on the local service of server 120 may be the operation to restart the local service. In other embodiments, the operational requirements may also include the requirement to perform a shutdown operation on the local service. Accordingly, the operation performed on the local service of server 120 may be the operation to shut down the local service.

[0072] The embodiments disclosed herein allow developers to focus solely on the browser and development code during the development and debugging process, without needing to pay attention to local services, thereby improving development efficiency and making the switching of development and debugging environments more efficient and convenient.

[0073] Figure 5A flowchart of a process 500 for switching a development and debugging environment according to some embodiments of the present disclosure is shown. Process 500 can be implemented in processes 300 and 400.

[0074] Process 500 allows for dynamic switching of the local development environment via a browser. Developer 510 can send WebSocket events to server 120 via client 110 by manipulating the page view of browser 520. Server 120 can create a local service (530) and shut down the currently running local service based on the passed parameters (540). It can also start the currently running local service. To improve the scalability of this process, custom functions, such as re-parsing configuration files, can be executed based on plugin configuration information before service restart (beforeRestartHook). Such custom functions can also be monitored at server 120 (560). Additionally, server 120 can also monitor (560) commands from other executors 511 (such as users). The environment switching plugin 570 can be used between server 120 and client 110 to switch between the development and debugging environments. The environment switching plugin 570 will be combined with... Figure 6 Let's discuss this in detail.

[0075] This solution can avoid Figure 2 This eliminates the need for developers to focus on local server services and allows them to switch the current packaging environment directly through the browser, greatly improving development efficiency and experience.

[0076] Figure 6 A flowchart of a process 600 for switching development and debugging environments according to some embodiments of the present disclosure is shown. Process 600 may be a specific embodiment of process 500.

[0077] In process 600, the environment code corresponding to the target development and debugging environment can be packaged using the packaging tool 610. If there is no reusable WebSocket communication connection, creation can be performed (620). Specifically, in plugin 630, an environment switching plugin 570 can be set up between plugin A 632 and plugin B 634. Plugin A and plugin B can be other appropriate types of plugins required between the browser client 110 and the server 120. For the environment switching plugin 570, a WebSocket (WS) client code snippet (674) can be injected into the packaged environment code. Then, a WebSocket event listener (672) can be added to the code snippet. In order to enable the developer 510 to switch environments in the browser, environment switching button code (676) can also be injected, so that the developer can trigger the WebSocket event through the button to achieve the switching of the development and debugging environment.

[0078] Through these exemplary implementations, developers can efficiently and conveniently switch between development and debugging environments when they need to switch to verify certain functionalities, or when they may be processing issues in parallel and need to monitor front-end effects under different environments. Specifically, while ensuring the security of online code, it shortens and simplifies the process of developers switching environments during debugging, avoiding the frequent switching between browsers and development tools found in traditional solutions. This reduces debugging costs for developers and improves the development experience. Compared to traditional methods, it is more efficient and does not introduce security issues associated with packaging and deploying off-line code.

[0079] Embodiments of this disclosure also provide corresponding apparatus for implementing the above methods or processes. Figure 7 A block diagram of an apparatus 700 for switching development and debugging environments according to certain embodiments of the present disclosure is shown. The apparatus 700 may be implemented as or included in a browser client 110. Various modules / components in the apparatus 700 may be implemented by hardware, software, firmware, or any combination thereof.

[0080] like Figure 7As shown, the apparatus 700 includes a code snippet adding module 710, configured to add a code snippet to packaged environment code at the browser client, the environment code corresponding to the target development and debugging environment, the code snippet being configured to enable the browser client to establish a communication connection with the server; a monitoring mechanism adding module 720, configured to add a monitoring mechanism for communication connection events to the code snippet, the monitoring mechanism including trigger monitoring of communication connection events associated with the browser client and transmission monitoring of communication connection events associated with the server; and a transmission module 730, configured to transmit the environment code to the server via the communication connection in response to the detection of a trigger of a communication connection event by the browser client, so that the server switches the current development and debugging environment to the target development and debugging environment based on the monitoring result of the communication connection event and the received environment code.

[0081] In some embodiments, the transmission module 730 is further configured to detect the triggering of a communication connection event by detecting operations on preset controls on the browser; and in response to detecting the triggering of a communication connection event, to transmit environment code to the server via the communication connection.

[0082] In some embodiments, the code snippet adding module 710 is further configured to add code snippets to the packaged environment code using a packaging tool that performs packaging on the environment code.

[0083] In some embodiments, the communication connection includes a communication connection based on the WebSocket communication protocol.

[0084] Embodiments of this disclosure also provide corresponding apparatus for implementing the above methods or processes. Figure 8 A block diagram of an apparatus 800 for switching development and debugging environments according to certain embodiments of the present disclosure is shown. The apparatus 800 may be implemented as or included in server 120. Various modules / components in the apparatus 800 may be implemented by hardware, software, firmware, or any combination thereof.

[0085] like Figure 8 As shown, the device 800 includes a monitoring module 810 configured to monitor the transmission of communication connection events by a browser client, which enables the browser client to establish a communication connection with the server; a receiving module 820 configured to receive packaged environment code from the browser client in response to the detected communication connection event transmitted by the browser client; and a switching module 830 configured to switch the current development and debugging environment at the server to a target development and debugging environment corresponding to the environment code based on the environment code.

[0086] In some embodiments, the environment code includes environment description information, and the switching module 830 is further configured to determine whether the environment description information matches the target development and debugging environment; and if the environment description information matches the target development and debugging environment, to switch the current development and debugging environment at the server to the target development and debugging environment corresponding to the environment code.

[0087] In some embodiments, the environment code includes operation parameters for the server, and the switching module 830 is further configured to determine the server's operation requirements for its local services based on the operation parameters; and to cause the server to perform corresponding operations on the local services based on the operation requirements.

[0088] In some embodiments, operational requirements include at least the need to perform a restart operation on the local service.

[0089] The units and / or modules included in devices 700 and 800 can be implemented in various ways, including software, hardware, firmware, or any combination thereof. In some embodiments, one or more units and / or modules can be implemented using software and / or firmware, such as machine-executable instructions stored on a storage medium. In addition to or as an alternative to machine-executable instructions, some or all of the units and / or modules in devices 700 and 800 can be implemented at least partially by one or more hardware logic components. By way of example and not limitation, exemplary types of hardware logic components that can be used include field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-chips (SoCs), complex programmable logic devices (CPLDs), and so on.

[0090] Figure 9 A block diagram of an electronic device 900 in which one or more embodiments of the present disclosure may be implemented is shown. It should be understood that... Figure 9 The electronic device 900 shown is merely exemplary and should not be construed as limiting the functionality and scope of the embodiments described herein. Figure 9 The electronic device 900 shown can be used to achieve Figure 1 The browser client 110 or the server 120, or Figure 7 Device 700 or Figure 8 Device 800.

[0091] like Figure 9As shown, electronic device 900 is in the form of a general-purpose computing device. Components of electronic device 900 may include, but are not limited to, one or more processors or processing units 910, memory 920, storage device 930, one or more communication units 940, one or more input devices 950, and one or more output devices 960. Processing unit 910 may be a physical or virtual processor and is capable of performing various processes according to programs stored in memory 920. In a multiprocessor system, multiple processing units execute computer-executable instructions in parallel to improve the parallel processing capability of electronic device 900.

[0092] Electronic device 900 typically includes multiple computer storage media. Such media can be any available media accessible to electronic device 900, including but not limited to volatile and non-volatile media, removable and non-removable media. Memory 920 can be volatile memory (e.g., registers, cache, random access memory (RAM)), non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. Storage device 930 can be removable or non-removable media and can include machine-readable media, such as flash drives, disks, or any other media capable of storing information and / or data and accessible within electronic device 900.

[0093] Electronic device 900 may further include additional removable / non-removable, volatile / non-volatile storage media. Although not explicitly stated... Figure 9 As shown, disk drives for reading from or writing to removable, non-volatile disks (e.g., "floppy disks") and optical disk drives for reading from or writing to removable, non-volatile optical disks can be provided. In these cases, each drive can be connected to a bus (not shown) via one or more data media interfaces. Memory 920 may include computer program product 925 having one or more program modules configured to perform various methods or actions of various embodiments of this disclosure.

[0094] The communication unit 940 enables communication with other electronic devices via a communication medium. Additionally, the functionality of the components of the electronic device 900 can be implemented using a single computing cluster or multiple computing machines capable of communicating via communication connections. Therefore, the electronic device 900 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or another network node.

[0095] Input device 950 can be one or more input devices, such as a mouse, keyboard, trackball, etc. Output device 960 can be one or more output devices, such as a monitor, speaker, printer, etc. Electronic device 900 can also communicate with one or more external devices (not shown) via communication unit 940 as needed. These external devices include storage devices, display devices, etc., and can communicate with one or more devices that enable user interaction with electronic device 900, or with any device that enables electronic device 900 to communicate with one or more other electronic devices (e.g., network card, modem, etc.). Such communication can be performed via input / output (I / O) interface (not shown).

[0096] According to an exemplary implementation of this disclosure, a computer-readable storage medium is provided that stores computer-executable instructions thereon, wherein the computer-executable instructions are executed by a processor to implement the methods described above. According to an exemplary implementation of this disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, which are executed by a processor to implement the methods described above.

[0097] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0098] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0099] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions that execute on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0100] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0101] Various implementations of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed implementations. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described implementations. The terminology used herein is chosen to best explain the principles, practical applications, or improvements to technology in the market, or to enable others skilled in the art to understand the various implementations disclosed herein.

Claims

1. A method for developing debugging environment switching, implemented at a browser client, comprising: adding a code snippet in packaged environment code, the environment code corresponding to a target developing debugging environment, the code snippet configured to cause the browser client to establish a communication connection with a server; adding a monitoring mechanism for a communication connection event to the code snippet, the monitoring mechanism comprising a trigger monitoring associated with the browser client for the communication connection event and a transmission monitoring associated with the server for the communication connection event; and in response to detecting a trigger of the communication connection event via the browser client, transmitting the environment code to the server through the communication connection to cause the server to switch a current developing debugging environment to the target developing debugging environment based on a monitoring result of the communication connection event and the received environment code. 2.The method of claim 1, wherein in response to detecting a trigger of the communication connection event via the browser, transmitting the environment code to the server through the communication connection comprises: detecting a trigger of the communication connection event by detecting an operation on a preset control on the browser; in response to detecting a trigger of the communication connection event, transmitting the environment code to the server through the communication connection. 3.The method of claim 1, wherein adding the code snippet in the packaged environment code comprises: adding the code snippet in the packaged environment code by a packaging tool that performs packaging on the environment code. 4.The method of claim 1, wherein the communication connection comprises a communication connection based on a WebSocket communication protocol. 5.A method for developing debugging environment switching, implemented at a server, comprising: monitoring a transmission of a communication connection event by a browser client, the communication connection event causing the browser client to establish a communication connection with the server; in response to monitoring the communication connection event transmitted by the browser client, receiving a packaged environment code from the browser client; and based on the environment code, switching a current developing debugging environment at the server to a target developing debugging environment corresponding to the environment code. 6.The method of claim 5, wherein the environment code comprises environment description information, and wherein switching a current developing debugging environment at the server to a target developing debugging environment corresponding to the environment code comprises: determining whether the environment description information matches the target developing debugging environment; and if the environment description information matches the target developing debugging environment, switching a current developing debugging environment at the server to a target developing debugging environment corresponding to the environment code. 7.The method of claim 5, wherein the environment code comprises an operation parameter for the server, and wherein switching a current developing debugging environment at the server to a target developing debugging environment corresponding to the environment code comprises: ​ determine, based on the operation parameter, an operation requirement of the service end on its local service; and cause the service end to perform a corresponding operation on the local service based on the operation requirement.

8. The method of claim 7, wherein the operation requirement comprises at least a requirement to perform a restart operation on the local service.

9. An apparatus for developing debugging environment switching, comprising: a code snippet adding module configured to add, at a browser client, a code snippet in packaged environment code, the environment code corresponding to a target developing debugging environment, the code snippet being configured to cause the browser client to establish a communication connection with a service end; a monitoring mechanism adding module configured to add, for the code snippet, a monitoring mechanism on a communication connection event, the monitoring mechanism comprising trigger monitoring associated with the browser client on the communication connection event and transmission monitoring associated with the service end on the communication connection event; and a transmission module configured to, in response to detecting, via the browser client, a trigger on the communication connection event, transmit the environment code to the service end through the communication connection to cause the service end to switch a current developing debugging environment to the target developing debugging environment based on a monitoring result on the communication connection event and the received environment code.

10. An apparatus for developing debugging environment switching, comprising: a monitoring module configured to monitor transmission of a communication connection event by a browser client, the communication connection event causing the browser client to establish a communication connection with a service end; a receiving module configured to, in response to monitoring the communication connection event transmitted by the browser client, receive, from the browser client, packaged environment code; and a switching module configured to, based on the environment code, switch a current developing debugging environment at the service end to a target developing debugging environment corresponding to the environment code. comprising:

11. An electronic device, comprising: at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions, when executed by the at least one processing unit, causing the electronic device to perform the method according to any one of claims 1-4 or 5-8. having a computer program stored thereon, the computer program being executable by a processor to implement the method according to any one of claims 1-4 or 5-8.

12. A computer-readable storage medium, characterized in that, 13. A computer program product tangibly stored in a computer storage medium and comprising computer executable instructions that, when executed by a device, cause the device to perform the method according to any one of claims 1-4 or 5-8. ​