WO2021203343A1 - Web request processing method and apparatus - Google Patents

Web request processing method and apparatus Download PDF

Info

Publication number
WO2021203343A1
WO2021203343A1 PCT/CN2020/083875 CN2020083875W WO2021203343A1 WO 2021203343 A1 WO2021203343 A1 WO 2021203343A1 CN 2020083875 W CN2020083875 W CN 2020083875W WO 2021203343 A1 WO2021203343 A1 WO 2021203343A1
Authority
WO
WIPO (PCT)
Prior art keywords
processing
data
web request
lua
function
Prior art date
Application number
PCT/CN2020/083875
Other languages
French (fr)
Chinese (zh)
Inventor
焦旭
Original Assignee
北京微动数联科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京微动数联科技有限公司 filed Critical 北京微动数联科技有限公司
Priority to PCT/CN2020/083875 priority Critical patent/WO2021203343A1/en
Priority to CN202080000785.6A priority patent/CN111937366B/en
Priority to TW110110397A priority patent/TWI815098B/en
Publication of WO2021203343A1 publication Critical patent/WO2021203343A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Definitions

  • the present invention relates to the field of computer technology, in particular, to a method for processing a Web (network) request, a device for processing a Web request, an electronic device, and a computer storage medium.
  • Wi-Fi chips are often used as Wi-Fi adapters.
  • the ESP8266 chip developed by Espressif Systems provides a set of highly integrated Wi-Fi chip solutions with low power consumption, compact design and high Stability and other characteristics. Only through SPI (Serial Peripheral Interface)/SDIO (Secure Digital Input Output) interface or UART (Universal Asynchronous Receiver Transmitter) interface can be used as a Wi-Fi adapter and applied to designs based on various microcontrollers.
  • SPI Serial Peripheral Interface
  • SDIO Secure Digital Input Output
  • UART Universal Asynchronous Receiver Transmitter
  • Wi-Fi chips such as ESP8266
  • a Web server is provided.
  • the request processing method is applied to a Wi-Fi chip with configurable Wi-Fi parameters, and the method includes:
  • the step of remotely invoking the LUA script and selecting a processing function corresponding to the Web request for processing includes:
  • the sent event is triggered, and the result obtained by executing the LUA function is sent.
  • step of loading the file to obtain the LUA function includes:
  • the LUA function is obtained by loading a file in a dofile manner.
  • step of selecting a processing function corresponding to the Web request for processing includes:
  • step of using the processing function to perform processing includes:
  • S121 wake up the cooperative program, execute the processing function to get the return data
  • S1221 Perform data slicing in response to the need to slice the returned data
  • S1222 In response to acquiring the threshold number of slices, suspend the cooperative program, and send the threshold number of slices;
  • steps S121 to S1222 are cyclically executed.
  • step of using the processing function to perform processing further includes:
  • the step of using the processing function for processing further includes: closing the connection when it is determined that the cooperative program is in a suspended state after the data is sent.
  • an embodiment of the present invention provides a Web request processing device, which is applied to a Wi-Fi chip capable of configuring Wi-Fi parameters, and the device includes:
  • the connection establishment module is configured to establish a connection for the Web request based on the received Web request
  • the data processing module is configured to remotely call the LUA script and select the processing function corresponding to the Web request for processing;
  • the sending module is configured to return processing result data.
  • an electronic device including:
  • One or more processors are One or more processors;
  • Storage device for storing one or more programs
  • the one or more processors implement the foregoing method.
  • an embodiment of the present invention provides a computer-readable medium having a computer program stored thereon, and is characterized in that the above-mentioned method is implemented when the program is executed by a processor.
  • the method, device, equipment and medium in the embodiments of the present invention realize the use of a Wi-Fi chip with limited storage and processing resources and configurable parameters to build a Web server, and realize more abundant functions on the Wi-Fi chip.
  • FIG. 1 is a schematic flowchart of a method for processing a Web request in some embodiments of the present invention
  • FIG. 2 is a schematic diagram of a Wi-Fi chip configuration process flow diagram in some embodiments of the present invention.
  • FIG. 3 is a schematic diagram of a process of processing a request using a cooperative program in some embodiments of the present invention
  • FIG. 4 is a schematic diagram of a flow chart of data processing on a Web request in some embodiments of the present invention.
  • FIG. 5 is a schematic diagram of a process of implementing remote invocation of LUA scripts in some embodiments of the present invention.
  • Figure 6 is a schematic structural diagram of a Web request processing apparatus in some embodiments of the present invention.
  • FIG. 7 is a schematic diagram of the structure of an electronic device in some embodiments of the present invention.
  • an embodiment of the present invention provides a method for processing a Web request, which is applied to a Wi-Fi chip with configurable Wi-Fi parameters, and the method includes:
  • the Wi-Fi chip in the embodiment of the present invention such as the ESP8266 chip, is divided into two operating modes, namely a configuration mode and a working mode, and the two modes are performed by a switch Switch.
  • the device must enter the configuration mode when it is used for the first time.
  • the operation method is to set the switch to the on state.
  • the execution logic of the configuration mode is to initialize the Wi-Fi module of the device, set it to AP mode, and then turn on the WEB service, which can process HTTP requests.
  • the client connects to the WI-FI network of the device and accesses the Web service through a browser.
  • the web server listens to the http request and processes it, and returns the processed result to the client.
  • the configuration mode supports the configuration of Wi-Fi information and cloud server information. After the configuration is complete, set the switch to off, and restart the device to enter the working mode. In the working mode, the device first connects to Wi-Fi, then performs time calibration on the device, and then connects to the cloud server. After the above tasks are completed, the device starts to transmit data.
  • the workflow is shown in Figure 2.
  • S120 Remotely call the LUA script to select the processing function corresponding to the Web request for processing; analyze the Web request to obtain the corresponding processing function for data processing, such as data query, data calculation, data packaging, etc., to form a processing result .
  • S130 Return the processing result data; after the processing result is obtained, data is packaged and sent according to the adopted data protocol, for example, the HTTP protocol is used for sending.
  • the adopted data protocol for example, the HTTP protocol is used for sending.
  • a Wi-Fi chip is used to build the server function. Due to the limited new capabilities of the Wi-Fi chip, there is no mature Web service framework. In order to meet the requirement of providing Web services, a set of Web service framework is implemented based on the LUA basic library. LUA is a lightweight and compact scripting language. The Wi-Fi chip can carry such scripting language functions for operation, and realize server functions by remotely calling LUA scripts.
  • the key technologies of the Web server include creating a TCP server (Transmission Control Protocol Server), capturing http (Hypertext Transfer Protocol) requests and establishing a connection, parsing and processing the requested data, returning the result to the client in the form of http, and closing the connection.
  • TCP server Transmission Control Protocol Server
  • http Hypertext Transfer Protocol
  • This embodiment mainly implements the analysis and processing of http request data. According to the selection, the features are as follows:
  • the steps of remotely calling the LUA script and selecting the processing function corresponding to the Web request for processing include:
  • the receive event is triggered, the request data is parsed, the LUA file name is obtained, the file is loaded to obtain the LUA function, the LUA function is executed, the sent event is triggered, and the result obtained by executing the LUA function is sent.
  • the step of loading the file to obtain the LUA function includes:
  • the method of processing Web requests in the implementation of the present invention adopts a cooperative program to process, which can reduce the requirements on the performance of the device without causing data transmission. mistake.
  • the step of selecting a processing function corresponding to the Web request for processing includes: creating a cooperative program corresponding to the Web request; specifying a processing function for the cooperative program; and processing using the processing function.
  • the step of using the processing function to perform processing includes:
  • step S1231 to step S1233 are cyclically executed.
  • the return data is obtained by executing the processing function of the cooperative program.
  • the data is sliced correspondingly, and then sent.
  • the cooperative program is suspended to reduce the performance requirements of the chip, and the data is sent cyclically until the data is sent. Sent.
  • the aforementioned cooperative program and data transmission can be performed in a similar parallel manner. For example, the cooperative program is suspended when sending data, and the cooperative program is awakened to continue execution after the data of the slice is sent, and the returned data is obtained, and then the slice is adaptively selected and suspended. Start the collaborative program and send the data.
  • one slice may be acquired and sent immediately.
  • the processing step of the processing function further includes:
  • a cooperative program is used to solve the problem of insufficient device memory and ensure support for larger data access scenarios.
  • the user sends a Web request, establishes a connection for the request, parses the requested data, and selects the corresponding
  • the processing function processes the request, returns the processing result data and closes the connection.
  • the data processing process uses a collaborative program to create a collaborative program and specify a processing function for each request.
  • the processing flow is: first wake up the collaborative program, execute the processing function to get the return data; then, the return data is sliced in order, and each slice is obtained Send, suspend the cooperative program before sending, wake up after sending and continue the slicing operation until the data is sent; finally close the connection to complete a request process.
  • the cooperative program ensures that the returned data of the same request can be sent continuously and correctly.
  • the step of using the processing function for processing further includes: S1236. After the data is sent, when it is determined that the cooperative program is in a suspended state, the connection is closed. Clear the occupation of resources in time.
  • the embodiment of the present invention can remotely call the LUA script through the http method.
  • the receive callback function is triggered.
  • the function parses the request data, obtains the LUA file name, and then loads the file in the dofile mode.
  • the processing function defined by the script is obtained, and the requested parameters are passed to the function to complete the data processing work.
  • This method requires the LUA script to follow the format definition: return function(connection,req,args).
  • the embodiment of the present invention provides a processing method for Web requests based on a Wi-Fi chip with configurable parameters. It can process large data requests based on limited memory resources, and can also realize remote calling of LUA scripts.
  • an embodiment of the present invention also provides a Web request processing apparatus 200, which is applied to a Wi-Fi chip capable of configuring Wi-Fi parameters, and the apparatus 200 includes:
  • the connection establishment module 210 is configured to establish a connection for the Web request based on the received Web request;
  • the data processing module 220 is configured to remotely call the LUA script and select the processing function corresponding to the Web request for processing;
  • the sending module 230 is configured to return processing result data.
  • the data processing module 220 is configured to:
  • the receive event is triggered, the request data is parsed, the LUA file name is obtained, the file is loaded to obtain the LUA function, the LUA function is executed, the sent event is triggered, and the result obtained by executing the LUA function is sent.
  • the data processing module 220 uses a dofile method to load a file to obtain the LUA function. Further, the data processing module 220 is further configured to create a coordinated program corresponding to the Web request; specify a processing function for the coordinated program; use the processing function to perform processing.
  • the data processing module 202 is also configured to wake up the cooperative program and execute the processing function to obtain the return data; in response to the return data needs to be sliced, perform data slicing; in response to obtaining a threshold number of slices, send it, and suspend all data.
  • the collaborative program is described, and the threshold number of slices is sent; in response to the data not being sent, the steps of wake-up and slice sending are repeated until the sending is completed; when the returned data does not need to be sliced, the data is sent directly; after the data is sent, it is judged When the cooperative program is in a suspended state, the connection is closed.
  • modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory.
  • the features and functions of two or more modules or units described above may be embodied in one module or unit.
  • the features and functions of a module or unit described above can be further divided into multiple modules or units to be embodied.
  • an electronic device capable of implementing the above method is also provided.
  • the electronic device 1100 according to this embodiment of the present invention will be described below with reference to FIG. 7.
  • the electronic device 1100 shown in FIG. 7 is only an example, and should not bring any limitation to the function and application scope of the embodiment of the present invention.
  • the electronic device 1100 is represented in the form of a general-purpose computing device.
  • the components of the electronic device 1100 may include, but are not limited to: the aforementioned at least one processing unit 1110, the aforementioned at least one storage unit 1120, and a bus 1130 connecting different system components (including the storage unit 1120 and the processing unit 1110).
  • the storage unit stores program code, and the program code can be executed by the processing unit 1110, so that the processing unit 1110 executes the various exemplary methods described in the “Exemplary Methods” section of this specification. Steps of implementation.
  • the processing unit 1110 may execute S110 as shown in FIG. 1 to receive a Web request and establish a connection for the Web request; S120 remotely invoke the LUA script, and select the processing function corresponding to the Web request for processing; S130 returns Process the result data.
  • the storage unit 1120 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 11201 and/or a cache storage unit 11202, and may further include a read-only storage unit (ROM) 11203.
  • RAM random access storage unit
  • ROM read-only storage unit
  • the storage unit 1120 may also include a program/utility tool 11204 having a set of (at least one) program module 11205.
  • program module 11205 includes but is not limited to: an operating system, one or more application programs, other program modules, and program data, Each of these examples or some combination may include the implementation of a network environment.
  • the bus 1130 may represent one or more of several types of bus structures, including a storage unit bus or a storage unit controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local area using any bus structure among multiple bus structures. bus.
  • the electronic device 1100 may also communicate with one or more external devices 1200 (such as keyboards, pointing devices, Bluetooth devices, etc.), and may also communicate with one or more devices that enable a user to interact with the electronic device 1100, and/or communicate with Any device (such as a router, modem, etc.) that enables the electronic device 1100 to communicate with one or more other computing devices. This communication can be performed through an input/output (I/O) interface 1150.
  • the electronic device 1100 may also communicate with one or more networks (for example, a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet) through the network adapter 1160.
  • networks for example, a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet
  • the network adapter 1160 communicates with other modules of the electronic device 1100 through the bus 1130. It should be understood that although not shown in the figure, other hardware and/or software modules can be used in conjunction with the electronic device 1100, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives And data backup storage system, etc.
  • the technical solution according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, U disk, mobile hard disk, etc.) or on the network , Including several instructions to make a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) execute the method according to the embodiment of the present invention.
  • a non-volatile storage medium which can be a CD-ROM, U disk, mobile hard disk, etc.
  • Including several instructions to make a computing device which can be a personal computer, a server, a terminal device, or a network device, etc.
  • a computer-readable storage medium on which is stored a program product capable of implementing the above-mentioned method in this specification.
  • various aspects of the present invention may also be implemented in the form of a program product, which includes program code.
  • the program product runs on a terminal device, the program code is used to make the The terminal device executes the steps according to various exemplary embodiments of the present invention described in the above-mentioned "Exemplary Method" section of this specification.
  • the program product for implementing the above method according to the embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer.
  • CD-ROM portable compact disk read-only memory
  • the program product of the present invention is not limited to this.
  • the readable storage medium can be any tangible medium that contains or stores a program, and the program can be used by or combined with an instruction execution system, device, or device.
  • the program product can use any combination of one or more readable media.
  • the readable medium may be a readable signal medium or a readable storage medium.
  • the readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or a combination of any of the above. More specific examples (non-exhaustive list) of readable storage media include: electrical connections with one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable Type programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • the computer-readable signal medium may include a data signal propagated in baseband or as a part of a carrier wave, and readable program code is carried therein. This propagated data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the readable signal medium may also be any readable medium other than a readable storage medium, and the readable medium may send, propagate, or transmit a program for use by or in combination with the instruction execution system, apparatus, or device.
  • the program code contained on the readable medium can be transmitted by any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
  • the program code used to perform the operations of the present invention can be written in any combination of one or more programming languages.
  • the programming languages include object-oriented programming languages—such as Java, C++, etc., as well as conventional procedural styles. Programming language-such as "C" language or similar programming language.
  • the program code can be executed entirely on the user's computing device, partly on the user's device, executed as an independent software package, partly on the user's computing device and partly executed on the remote computing device, or entirely on the remote computing device or server Executed on.
  • the remote computing device can be connected to a user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (for example, using Internet service providers). Business to connect via the Internet).
  • LAN local area network
  • WAN wide area network
  • Internet service providers for example, using Internet service providers.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)
  • Stored Programmes (AREA)
  • Telephonic Communication Services (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The present invention relates to the technical field of computers, and specifically provides a web request processing method, which is applied to a WiFi chip that can be configured with WiFi parameters. The method comprises: receiving a web request, and establishing a connection for the web request; remotely calling an LUA script, and selecting a processing function corresponding to the web request for processing; and returning processing result data. Further correspondingly provided are an apparatus, a device and a medium. According to the web request processing method in the present invention, the functions of a web server can be realized on the basis of a WiFi chip, and a web server architecture is constructed.

Description

Web请求处理方法和装置Web request processing method and device 技术领域Technical field
本发明涉及计算机技术领域,具体而言,涉及一种Web(网络)请求处理方法、一种Web请求处理装置、一种电子设备和一种计算机存储介质。The present invention relates to the field of computer technology, in particular, to a method for processing a Web (network) request, a device for processing a Web request, an electronic device, and a computer storage medium.
背景技术Background technique
现有技术Wi-Fi芯片常作为Wi-Fi适配器来使用,例如,乐鑫公司开发的ESP8266芯片,提供了一套高度集成的Wi-Fi芯片解决方案,其具有低功耗、紧凑设计和高稳定性等特点。只需通过SPI(串行外设接口)/SDIO(安全数字输入输出)接口或UART(通用异步收发传输器)接口即可作为Wi-Fi适配器,应用到基于各种微控制器的设计中。详细的功能说明可见其官方网站https://www.espressif.com/zh-hans/products/hardware/esp8266ex/overview。Prior art Wi-Fi chips are often used as Wi-Fi adapters. For example, the ESP8266 chip developed by Espressif Systems provides a set of highly integrated Wi-Fi chip solutions with low power consumption, compact design and high Stability and other characteristics. Only through SPI (Serial Peripheral Interface)/SDIO (Secure Digital Input Output) interface or UART (Universal Asynchronous Receiver Transmitter) interface can be used as a Wi-Fi adapter and applied to designs based on various microcontrollers. The detailed function description can be found on its official website https://www.espressif.com/zh-hans/products/hardware/esp8266ex/overview.
由于ESP8266的价格比较低,现在已经应用于多种物联网系统中。但由于其作为Wi-Fi芯片的本质,性能受限,目前所提供的软件仅限于在Wi-Fi配置方面的功能,而无法提供更丰富的功能。如果想提供更丰富的Web服务,则需要提升硬件配置以运行Web服务器,从而会导致整个系统的成本大幅增加。Due to the relatively low price of ESP8266, it has now been used in a variety of IoT systems. However, due to its nature as a Wi-Fi chip and limited performance, the software currently provided is limited to the functions of Wi-Fi configuration and cannot provide richer functions. If you want to provide richer Web services, you need to upgrade the hardware configuration to run the Web server, which will lead to a substantial increase in the cost of the entire system.
而要基于诸如ESP8266这样的Wi-Fi芯片实现服务器的功能的话,会面临几个问题:首先是该芯片没有提供直接的服务器软件或相关必要的函数,功能不全;其次,由于Wi-Fi芯片自身硬件的限制,在实现服务器功能的时候,所处理的数据访问量会显得内存不足。However, if you want to implement server functions based on Wi-Fi chips such as ESP8266, you will face several problems: first, the chip does not provide direct server software or related necessary functions, and the functions are incomplete; second, due to the Wi-Fi chip itself Due to hardware limitations, the amount of processed data access will appear to be insufficient in memory when implementing server functions.
发明内容Summary of the invention
本发明为了解决现有技术中,可配置参数的Wi-Fi芯片功能有限的问题,提出了一种利用Wi-Fi芯片搭建Web服务器功能的技术,具体地,第一方面,提供了一种Web请求处理方法,应用于可配置Wi-Fi参数的Wi-Fi芯片,所述方法包括:In order to solve the problem of limited functions of Wi-Fi chips with configurable parameters in the prior art, the present invention proposes a technology for building Web server functions using Wi-Fi chips. Specifically, in the first aspect, a Web server is provided. The request processing method is applied to a Wi-Fi chip with configurable Wi-Fi parameters, and the method includes:
接收Web请求,为所述Web请求建立连接;Receiving a web request, and establishing a connection for the web request;
远程调用LUA脚本,选择与所述Web请求对应的处理函数进行处理;Remotely call the LUA script and select the processing function corresponding to the Web request for processing;
返回处理结果数据。Return processing result data.
进一步地,所述远程调用LUA脚本,选择与所述Web请求对应的处理函数进行处理的步骤包括:Further, the step of remotely invoking the LUA script and selecting a processing function corresponding to the Web request for processing includes:
触发receive事件;Trigger the receive event;
解析请求数据,获取到LUA文件名;Parse the request data and get the LUA file name;
加载文件获取LUA函数;Load the file to get the LUA function;
执行LUA函数;Execute LUA function;
触发sent事件,发送执行所述LUA函数所获取到的结果。The sent event is triggered, and the result obtained by executing the LUA function is sent.
进一步地,所述加载文件获取LUA函数的步骤包括:Further, the step of loading the file to obtain the LUA function includes:
采用dofile方式加载文件获取所述LUA函数。The LUA function is obtained by loading a file in a dofile manner.
进一步地,所述选择与所述Web请求对应的处理函数进行处理的步骤包括:Further, the step of selecting a processing function corresponding to the Web request for processing includes:
创建与所述Web请求对应的协同程序;Creating a collaborative program corresponding to the Web request;
为所述协同程序指定处理函数;以及Specify a processing function for the cooperative program; and
利用所述处理函数进行处理。Use the processing function for processing.
进一步地,所述利用所述处理函数进行处理的步骤包括:Further, the step of using the processing function to perform processing includes:
S121:唤醒协同程序,执行处理函数得到返回数据;S121: wake up the cooperative program, execute the processing function to get the return data;
S1221:响应于返回数据需要切片,而进行数据切片;S1221: Perform data slicing in response to the need to slice the returned data;
S1222:响应于获取到阈值个切片,挂起所述协同程序,并发送所述阈值个切片;S1222: In response to acquiring the threshold number of slices, suspend the cooperative program, and send the threshold number of slices;
S1223:响应于数据未发送完毕,循环执行步骤S121~S1222。S1223: In response to the data not being sent, steps S121 to S1222 are cyclically executed.
进一步地,所述利用所述处理函数进行处理的步骤还包括:Further, the step of using the processing function to perform processing further includes:
响应于返回数据不需要切片,直接进行数据发送。In response to the returned data, no slicing is required, and the data is sent directly.
进一步地,所述利用所述处理函数进行处理的步骤还包括:数据发送后,判断所述协同程序为挂起状态时,关闭所述连接。Further, the step of using the processing function for processing further includes: closing the connection when it is determined that the cooperative program is in a suspended state after the data is sent.
第二方面,本发明实施例提供了一种Web请求处理装置,应用于可配置Wi-Fi参数的Wi-Fi芯片,所述装置包括:In the second aspect, an embodiment of the present invention provides a Web request processing device, which is applied to a Wi-Fi chip capable of configuring Wi-Fi parameters, and the device includes:
连接建立模块,被配置为基于接收到的Web请求,为所述Web请求建立连接;The connection establishment module is configured to establish a connection for the Web request based on the received Web request;
数据处理模块,被配置为远程调用LUA脚本,选择与所述Web请求对应的处理函数进行处理;The data processing module is configured to remotely call the LUA script and select the processing function corresponding to the Web request for processing;
发送模块,被配置为返回处理结果数据。The sending module is configured to return processing result data.
第三方面,本发明实施例提供了一种电子设备,包括:In the third aspect, an embodiment of the present invention provides an electronic device, including:
一个或多个处理器;One or more processors;
存储装置,用于存储一个或多个程序,Storage device for storing one or more programs,
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现上述的方法。When the one or more programs are executed by the one or more processors, the one or more processors implement the foregoing method.
第四方面,本发明实施例提供了一种计算机可读介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现上述的方法。In a fourth aspect, an embodiment of the present invention provides a computer-readable medium having a computer program stored thereon, and is characterized in that the above-mentioned method is implemented when the program is executed by a processor.
本发明实施例中的方法、装置、设备和介质,实现利用存储和处理资源有限的可配置参数的Wi-Fi芯片,搭建Web服务器,在Wi-Fi芯片上实现更丰富的功能。The method, device, equipment and medium in the embodiments of the present invention realize the use of a Wi-Fi chip with limited storage and processing resources and configurable parameters to build a Web server, and realize more abundant functions on the Wi-Fi chip.
附图说明Description of the drawings
通过参考附图会更加清楚的理解本发明的特征和优点,附图是示意性的而不应理解为对本发明进行任何限制,在附图中:The features and advantages of the present invention will be more clearly understood by referring to the accompanying drawings. The accompanying drawings are schematic and should not be construed as limiting the present invention in any way. In the accompanying drawings:
图1为本发明一些实施例中的Web请求处理方法的流程示意图;FIG. 1 is a schematic flowchart of a method for processing a Web request in some embodiments of the present invention;
图2为本发明一些实施例中的Wi-Fi芯片配置过程流程示意图;2 is a schematic diagram of a Wi-Fi chip configuration process flow diagram in some embodiments of the present invention;
图3为本发明一些实施例中的利用协同程序处理请求的流程示意图;FIG. 3 is a schematic diagram of a process of processing a request using a cooperative program in some embodiments of the present invention;
图4为本发明一些实施例中的对Web请求进行数据处理的流程示意图示意图;4 is a schematic diagram of a flow chart of data processing on a Web request in some embodiments of the present invention;
图5为本发明一些实施例中的实现LUA脚本远程调用的流程示意图;FIG. 5 is a schematic diagram of a process of implementing remote invocation of LUA scripts in some embodiments of the present invention;
图6为本发明一些实施例中的Web请求处理装置的结构示意图;Figure 6 is a schematic structural diagram of a Web request processing apparatus in some embodiments of the present invention;
图7为本发明一些实施例中的电子设备的结构示意图。FIG. 7 is a schematic diagram of the structure of an electronic device in some embodiments of the present invention.
具体实施方式Detailed ways
为了能够更清楚地理解本发明的上述目的、特征和优点,下面结合附图和具体实施方式对本发明进行进一步的详细描述。需要说明的是,在不冲突的情况下,本申请的实施例及实施例中的特征可以相互组合。In order to be able to understand the above objectives, features and advantages of the present invention more clearly, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the application and the features in the embodiments can be combined with each other if there is no conflict.
在下面的描述中阐述了很多具体细节以便于充分理解本发明,但是,本发明还可以采用其他不同于在此描述的其他方式来实施,因此,本发明的保护范围并不受下面公开的具体实施例的限制。In the following description, many specific details are set forth in order to fully understand the present invention. However, the present invention can also be implemented in other ways different from those described here. Therefore, the protection scope of the present invention is not limited to the specific details disclosed below. Limitations of the embodiment.
如图1所示,本发明实施例提供了一种Web请求处理方法,应用于可配置Wi-Fi参数的Wi-Fi芯片,所述方法包括:As shown in FIG. 1, an embodiment of the present invention provides a method for processing a Web request, which is applied to a Wi-Fi chip with configurable Wi-Fi parameters, and the method includes:
S110、接收Web请求,为所述Web请求建立连接;本发明实施例中的Wi-Fi芯片,例如ESP8266芯片,分为两种运行模式,分别是配置模式和工作模式,两种模式通过开关进行切换。设备初次使用要先进入配置模式,操作方法是将开关置于开状态。配置模式的执行逻辑是将设备的WI-FI模块进行初始化,将其置为AP模式,然后开启WEB服务,该服务可以对HTTP请求进行处理。客户端接入设备的WI-FI网络,通过浏览器访问Web服务。Web服务器侦听http请求并进行处理,将处理后结果返回给客户端。配置模式支持对Wi-Fi信息、云服务器信息进行配置。配置完成后将开关置为关,重启设备便可进入工作模式。在工作模式 下,设备首先连接Wi-Fi,然后对设备进行校时,接着连接云服务器,完成以上工作后设备便开始传输数据。工作流程如图2所示。S110. Receive a Web request, and establish a connection for the Web request; the Wi-Fi chip in the embodiment of the present invention, such as the ESP8266 chip, is divided into two operating modes, namely a configuration mode and a working mode, and the two modes are performed by a switch Switch. The device must enter the configuration mode when it is used for the first time. The operation method is to set the switch to the on state. The execution logic of the configuration mode is to initialize the Wi-Fi module of the device, set it to AP mode, and then turn on the WEB service, which can process HTTP requests. The client connects to the WI-FI network of the device and accesses the Web service through a browser. The web server listens to the http request and processes it, and returns the processed result to the client. The configuration mode supports the configuration of Wi-Fi information and cloud server information. After the configuration is complete, set the switch to off, and restart the device to enter the working mode. In the working mode, the device first connects to Wi-Fi, then performs time calibration on the device, and then connects to the cloud server. After the above tasks are completed, the device starts to transmit data. The workflow is shown in Figure 2.
S120、远程调用LUA脚本,选择与所述Web请求对应的处理函数进行处理;根据Web请求进行解析获取相应的处理函数进行数据处理,例如,数据查询、数据计算、数据打包等操作,形成处理结果。S120. Remotely call the LUA script to select the processing function corresponding to the Web request for processing; analyze the Web request to obtain the corresponding processing function for data processing, such as data query, data calculation, data packaging, etc., to form a processing result .
S130、返回处理结果数据;获取处理结果之后,根据采用的数据协议进行数据打包发送,例如采用http协议方式进行发送。S130: Return the processing result data; after the processing result is obtained, data is packaged and sent according to the adopted data protocol, for example, the HTTP protocol is used for sending.
本发明实施例中采用Wi-Fi芯片搭建服务器功能,由于Wi-Fi芯片新能受限没有成熟的Web服务框架,为了满足提供Web服务的需求,基于LUA基础库实现一套Web服务框架。LUA是一种轻量小巧的脚本语言,所述Wi-Fi芯片能够承载此类脚本语言函数进行运行,通过远程调用LUA脚本实现服务器功能。In the embodiment of the present invention, a Wi-Fi chip is used to build the server function. Due to the limited new capabilities of the Wi-Fi chip, there is no mature Web service framework. In order to meet the requirement of providing Web services, a set of Web service framework is implemented based on the LUA basic library. LUA is a lightweight and compact scripting language. The Wi-Fi chip can carry such scripting language functions for operation, and realize server functions by remotely calling LUA scripts.
Web服务器关键技术包括创建TCP server(传输控制协议服务器),捕捉http(超文本传输协议)请求并建立连接,对请求数据进行解析和处理,将结果以http形式返回客户端,关闭连接。本实施例主要实现对http请求数据的解析和处理。根据选择可实现具有特点如下:The key technologies of the Web server include creating a TCP server (Transmission Control Protocol Server), capturing http (Hypertext Transfer Protocol) requests and establishing a connection, parsing and processing the requested data, returning the result to the client in the form of http, and closing the connection. This embodiment mainly implements the analysis and processing of http request data. According to the selection, the features are as follows:
1)支持多种请求方式,包括get(获取)、post(张贴)、put(放置)等,根据不同的Web请求方式,进行解析。1) Support a variety of request methods, including get (get), post (post), put (place), etc., and analyze according to different web request methods.
2)支持http访问认证;2) Support http access authentication;
3)实现http方式远程调用LUA脚本;3) Realize remote calling of LUA scripts in http mode;
4)支持多种请求编码;4) Support multiple request codes;
5)能够正确处理单次请求返回较大数据量的场景。5) It can correctly handle scenarios where a single request returns a large amount of data.
本发明实施例中采用远程调用LUA脚本,选择与所述Web请求对应的处理函数进行处理的步骤包括:In the embodiment of the present invention, the steps of remotely calling the LUA script and selecting the processing function corresponding to the Web request for processing include:
触发receive事件,解析请求数据,获取到LUA文件名,加载文件获取LUA函数,执行LUA函数,触发sent事件,发送执行所述LUA函数所获取到的结果。The receive event is triggered, the request data is parsed, the LUA file name is obtained, the file is loaded to obtain the LUA function, the LUA function is executed, the sent event is triggered, and the result obtained by executing the LUA function is sent.
本发明实施例中,所述加载文件获取LUA函数的步骤包括:In the embodiment of the present invention, the step of loading the file to obtain the LUA function includes:
采用dofile方式加载文件获取所述LUA函数Use dofile to load files to obtain the LUA function
为了在性能受限的Wi-Fi芯片实现处理较大数据量的场景,本发明实施中的处理Web请求的方式采用协同程序来处理,能够减小对设备性能的要求,同时不会造成数据传输错误。具体地,所述选择与所述Web请求对应的处理函数进行处理的步骤包括:创建与所述Web 请求对应的协同程序;为所述协同程序指定处理函数;以及利用所述处理函数进行处理。进一步地,如图3所示,所述利用所述处理函数进行处理的步骤包括:In order to realize the scenario of processing a large amount of data on the Wi-Fi chip with limited performance, the method of processing Web requests in the implementation of the present invention adopts a cooperative program to process, which can reduce the requirements on the performance of the device without causing data transmission. mistake. Specifically, the step of selecting a processing function corresponding to the Web request for processing includes: creating a cooperative program corresponding to the Web request; specifying a processing function for the cooperative program; and processing using the processing function. Further, as shown in FIG. 3, the step of using the processing function to perform processing includes:
S1231、唤醒协同程序,执行处理函数得到返回数据;S1231, wake up the cooperative program, execute the processing function to get the return data;
S1232、响应于返回数据需要切片,而进行数据切片;S1232, perform data slicing in response to the need to slice the returned data;
S1233响应于获取到阈值个切片,挂起所述协同程序,并发送所述阈值个切片;S1233, in response to acquiring the threshold number of slices, suspend the cooperative program, and send the threshold number of slices;
S1234,响应于数据未发送完毕,循环执行步骤S1231至步骤S1233。In S1234, in response to the data transmission is not completed, step S1231 to step S1233 are cyclically executed.
本发明实施例中通过协同程序执行处理函数得到返回数据,当数据量较大时,对应进行数据切片,然后发送,发送时,挂起所述协同程序,降低对芯片性能要求,循环发送直到数据发送完毕。上述协同程序和数据发送可以类似并行的方式进行,例如,当发送数据时挂起协同程序,切片的数据发送完之后又唤醒所述协同程序继续执行,获取返回数据,然后适应性选择切片,挂起协同程序然后发送数据。采用协同程序保证了,多个处理请求都能被执行,避免由于单个请求获取数据较多造成其他请求不被处理的情况。为了减小对芯片性能的要求,本发明实施例中,可以获取到1个切片后即进行发送。In the embodiment of the present invention, the return data is obtained by executing the processing function of the cooperative program. When the amount of data is large, the data is sliced correspondingly, and then sent. When sending, the cooperative program is suspended to reduce the performance requirements of the chip, and the data is sent cyclically until the data is sent. Sent. The aforementioned cooperative program and data transmission can be performed in a similar parallel manner. For example, the cooperative program is suspended when sending data, and the cooperative program is awakened to continue execution after the data of the slice is sent, and the returned data is obtained, and then the slice is adaptively selected and suspended. Start the collaborative program and send the data. The use of a collaborative program ensures that multiple processing requests can be executed, avoiding the situation that other requests are not processed due to a single request for obtaining more data. In order to reduce the requirements on the performance of the chip, in the embodiment of the present invention, one slice may be acquired and sent immediately.
本发明实施例中当获取的返回数据数据量较小时,或者没有其他协同程序要运行时,可以进行直接发送。具体地,所述处理函数进行处理的步骤还包括:In the embodiment of the present invention, when the amount of returned data acquired is small, or when there is no other collaborative program to run, it can be sent directly. Specifically, the processing step of the processing function further includes:
S1235、响应于返回数据不需要切片,直接进行数据发送。S1235. In response to returning the data without slicing, directly send the data.
如图4所示,本发明实施例中使用协同程序解决设备内存不足问题,保证对较大数据量访问场景的支持,用户发送Web请求,为请求建立连接,对请求数据进行解析,选择相应的处理函数对请求进行处理,返回处理结果数据并关闭连接。数据处理过程采用协同程序,为每次请求创建协同程序并指定处理函数,处理流程是:首先唤醒协同程序,执行处理函数得到返回数据;然后,对返回数据按序进行切片,每获取一个切片便进行发送,发送前将协同程序挂起,发送完后唤醒并继续切片操作直到数据发送完;最后关闭连接完成一次请求过程。协同程序保证同一请求的返回数据能够连续正确地发送。As shown in Figure 4, in the embodiment of the present invention, a cooperative program is used to solve the problem of insufficient device memory and ensure support for larger data access scenarios. The user sends a Web request, establishes a connection for the request, parses the requested data, and selects the corresponding The processing function processes the request, returns the processing result data and closes the connection. The data processing process uses a collaborative program to create a collaborative program and specify a processing function for each request. The processing flow is: first wake up the collaborative program, execute the processing function to get the return data; then, the return data is sliced in order, and each slice is obtained Send, suspend the cooperative program before sending, wake up after sending and continue the slicing operation until the data is sent; finally close the connection to complete a request process. The cooperative program ensures that the returned data of the same request can be sent continuously and correctly.
进一步地,所述利用所述处理函数进行处理的步骤还包括:S1236、数据发送后,判断所述协同程序为挂起状态时,关闭所述连接。及时清空资源的占用。Further, the step of using the processing function for processing further includes: S1236. After the data is sent, when it is determined that the cooperative program is in a suspended state, the connection is closed. Clear the occupation of resources in time.
如图5所示,本发明实施例可以实现通过http方式远程调用LUA脚本,请求到达后,触发receive的回调函数,该函数对请求数据进行解析,获取到LUA文件名称,然后用dofile方式加载文件便得到该脚本定义的处理函数,将请求的参数传递给该函数完成数据处理工作。此方式要求LUA脚本遵循格式定义为:return function(connection,req,args)。As shown in Figure 5, the embodiment of the present invention can remotely call the LUA script through the http method. After the request arrives, the receive callback function is triggered. The function parses the request data, obtains the LUA file name, and then loads the file in the dofile mode. The processing function defined by the script is obtained, and the requested parameters are passed to the function to complete the data processing work. This method requires the LUA script to follow the format definition: return function(connection,req,args).
本发明实施例基于可配置参数的Wi-Fi芯片,提供了一种针对Web请求的处理方法。能够基于有限的内存资源处理较大数据请求的场景,也能实现远程调用LUA脚本。The embodiment of the present invention provides a processing method for Web requests based on a Wi-Fi chip with configurable parameters. It can process large data requests based on limited memory resources, and can also realize remote calling of LUA scripts.
如图6所示,本发明实施例还提供了一种Web请求处理装置200,应用于可配置Wi-Fi参数的Wi-Fi芯片,所述装置200包括:As shown in FIG. 6, an embodiment of the present invention also provides a Web request processing apparatus 200, which is applied to a Wi-Fi chip capable of configuring Wi-Fi parameters, and the apparatus 200 includes:
连接建立模块210,被配置为基于接收到的Web请求,为所述Web请求建立连接;The connection establishment module 210 is configured to establish a connection for the Web request based on the received Web request;
数据处理模块220,被配置为远程调用LUA脚本,选择与所述Web请求对应的处理函数进行处理;The data processing module 220 is configured to remotely call the LUA script and select the processing function corresponding to the Web request for processing;
发送模块230,被配置为返回处理结果数据。The sending module 230 is configured to return processing result data.
进一步地,所述数据处理模块220配置为:Further, the data processing module 220 is configured to:
触发receive事件,解析请求数据,获取到LUA文件名,加载文件获取LUA函数,执行LUA函数,触发sent事件,发送执行所述LUA函数所获取到的结果。The receive event is triggered, the request data is parsed, the LUA file name is obtained, the file is loaded to obtain the LUA function, the LUA function is executed, the sent event is triggered, and the result obtained by executing the LUA function is sent.
进一步地,所述数据处理模块220采用dofile方式加载文件获取所述LUA函数。进一步地,所述数据处理模块220还被配置为,创建与所述Web请求对应的协同程序;为所述协同程序指定处理函数;利用所述处理函数进行处理。Further, the data processing module 220 uses a dofile method to load a file to obtain the LUA function. Further, the data processing module 220 is further configured to create a coordinated program corresponding to the Web request; specify a processing function for the coordinated program; use the processing function to perform processing.
进一步地,所述数据处理模块202还被配置为,唤醒协同程序,执行处理函数得到返回数据;响应于返回数据需要切片,进行数据切片;响应于获取到阈值个切片,进行发送,挂起所述协同程序,并发送所述阈值个切片;响应于数据未发送完毕,循环进行唤醒、切片发送的步骤直至发送完毕;当返回数据不需要切片时进行直接进行数据发送;数据发送后,判断所述协同程序为挂起状态时,关闭所述连接。Further, the data processing module 202 is also configured to wake up the cooperative program and execute the processing function to obtain the return data; in response to the return data needs to be sliced, perform data slicing; in response to obtaining a threshold number of slices, send it, and suspend all data. The collaborative program is described, and the threshold number of slices is sent; in response to the data not being sent, the steps of wake-up and slice sending are repeated until the sending is completed; when the returned data does not need to be sliced, the data is sent directly; after the data is sent, it is judged When the cooperative program is in a suspended state, the connection is closed.
上述模块所执行的步骤详细细节已在上述的方法实施例中进行了描述,在此不再进行赘述。The detailed details of the steps performed by the above modules have been described in the above method embodiments, and will not be repeated here.
应当注意,尽管在上文详细描述中提及了用于动作执行的设备的若干模块或者单元,但是这种划分并非强制性的。实际上,根据本发明的实施方式,上文描述的两个或更多模块或者单元的特征和功能可以在一个模块或者单元中具体化。反之,上文描述的一个模块或者单元的特征和功能可以进一步划分为由多个模块或者单元来具体化。It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present invention, the features and functions of two or more modules or units described above may be embodied in one module or unit. Conversely, the features and functions of a module or unit described above can be further divided into multiple modules or units to be embodied.
此外,尽管在附图中以特定顺序描述了本发明中方法的各个步骤,但是,这并非要求或者暗示必须按照该特定顺序来执行这些步骤,或是必须执行全部所示的步骤才能实现期望的 结果。附加的或备选的,可以省略某些步骤,将多个步骤合并为一个步骤执行,以及/或者将一个步骤分解为多个步骤执行等。In addition, although the various steps of the method of the present invention are described in a specific order in the drawings, this does not require or imply that these steps must be performed in the specific order, or that all the steps shown must be performed to achieve the desired result. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step for execution, and/or one step may be decomposed into multiple steps for execution, etc.
在本发明的示例性实施例中,还提供了一种能够实现上述方法的电子设备。In an exemplary embodiment of the present invention, an electronic device capable of implementing the above method is also provided.
所属技术领域的技术人员能够理解,本发明的各个方面可以实现为系统、方法或程序产品。因此,本发明的各个方面可以具体实现为以下形式,即:完全的硬件实施方式、完全的软件实施方式(包括固件、微代码等),或硬件和软件方面结合的实施方式,这里可以统称为“电路”、“模块”或“系统”。Those skilled in the art can understand that various aspects of the present invention can be implemented as a system, a method, or a program product. Therefore, various aspects of the present invention can be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which can be collectively referred to herein as "Circuit", "Module" or "System".
下面参照图7来描述根据本发明的这种实施方式的电子设备1100。图7显示的电子设备1100仅仅是一个示例,不应对本发明实施例的功能和使用范围带来任何限制。The electronic device 1100 according to this embodiment of the present invention will be described below with reference to FIG. 7. The electronic device 1100 shown in FIG. 7 is only an example, and should not bring any limitation to the function and application scope of the embodiment of the present invention.
如图7所示,电子设备1100以通用计算设备的形式表现。电子设备1100的组件可以包括但不限于:上述至少一个处理单元1110、上述至少一个存储单元1120、连接不同系统组件(包括存储单元1120和处理单元1110)的总线1130。As shown in FIG. 7, the electronic device 1100 is represented in the form of a general-purpose computing device. The components of the electronic device 1100 may include, but are not limited to: the aforementioned at least one processing unit 1110, the aforementioned at least one storage unit 1120, and a bus 1130 connecting different system components (including the storage unit 1120 and the processing unit 1110).
其中,所述存储单元存储有程序代码,所述程序代码可以被所述处理单元1110执行,使得所述处理单元1110执行本说明书上述“示例性方法”部分中描述的根据本发明各种示例性实施方式的步骤。例如,所述处理单元1110可以执行如图1中所示的S110接收Web请求,为所述Web请求建立连接;S120远程调用LUA脚本,选择与所述Web请求对应的处理函数进行处理;S130返回处理结果数据。Wherein, the storage unit stores program code, and the program code can be executed by the processing unit 1110, so that the processing unit 1110 executes the various exemplary methods described in the “Exemplary Methods” section of this specification. Steps of implementation. For example, the processing unit 1110 may execute S110 as shown in FIG. 1 to receive a Web request and establish a connection for the Web request; S120 remotely invoke the LUA script, and select the processing function corresponding to the Web request for processing; S130 returns Process the result data.
存储单元1120可以包括易失性存储单元形式的可读介质,例如随机存取存储单元(RAM)11201和/或高速缓存存储单元11202,还可以进一步包括只读存储单元(ROM)11203。The storage unit 1120 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 11201 and/or a cache storage unit 11202, and may further include a read-only storage unit (ROM) 11203.
存储单元1120还可以包括具有一组(至少一个)程序模块11205的程序/实用工具11204,这样的程序模块11205包括但不限于:操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。The storage unit 1120 may also include a program/utility tool 11204 having a set of (at least one) program module 11205. Such program module 11205 includes but is not limited to: an operating system, one or more application programs, other program modules, and program data, Each of these examples or some combination may include the implementation of a network environment.
总线1130可以为表示几类总线结构中的一种或多种,包括存储单元总线或者存储单元控制器、外围总线、图形加速端口、处理单元或者使用多种总线结构中的任意总线结构的局域总线。The bus 1130 may represent one or more of several types of bus structures, including a storage unit bus or a storage unit controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local area using any bus structure among multiple bus structures. bus.
电子设备1100也可以与一个或多个外部设备1200(例如键盘、指向设备、蓝牙设备等)通信,还可与一个或者多个使得用户能与该电子设备1100交互的设备通信,和/或与使得该电子设备1100能与一个或多个其它计算设备进行通信的任何设备(例如路由器、调制解调器等等)通信。这种通信可以通过输入/输出(I/O)接口1150进行。并且,电子设备1100还可以通过网络适配器1160与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或 公共网络,例如因特网)通信。如图所示,网络适配器1160通过总线1130与电子设备1100的其它模块通信。应当明白,尽管图中未示出,可以结合电子设备1100使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、RAID系统、磁带驱动器以及数据备份存储系统等。The electronic device 1100 may also communicate with one or more external devices 1200 (such as keyboards, pointing devices, Bluetooth devices, etc.), and may also communicate with one or more devices that enable a user to interact with the electronic device 1100, and/or communicate with Any device (such as a router, modem, etc.) that enables the electronic device 1100 to communicate with one or more other computing devices. This communication can be performed through an input/output (I/O) interface 1150. In addition, the electronic device 1100 may also communicate with one or more networks (for example, a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet) through the network adapter 1160. As shown in the figure, the network adapter 1160 communicates with other modules of the electronic device 1100 through the bus 1130. It should be understood that although not shown in the figure, other hardware and/or software modules can be used in conjunction with the electronic device 1100, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives And data backup storage system, etc.
通过以上的实施方式的描述,本领域的技术人员易于理解,这里描述的示例实施方式可以通过软件实现,也可以通过软件结合必要的硬件的方式来实现。因此,根据本发明实施方式的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性存储介质(可以是CD-ROM,U盘,移动硬盘等)中或网络上,包括若干指令以使得一台计算设备(可以是个人计算机、服务器、终端装置、或者网络设备等)执行根据本发明实施方式的方法。Through the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described here can be implemented by software, or can be implemented by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, U disk, mobile hard disk, etc.) or on the network , Including several instructions to make a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) execute the method according to the embodiment of the present invention.
在本发明的示例性实施例中,还提供了一种计算机可读存储介质,其上存储有能够实现本说明书上述方法的程序产品。在一些可能的实施方式中,本发明的各个方面还可以实现为一种程序产品的形式,其包括程序代码,当所述程序产品在终端设备上运行时,所述程序代码用于使所述终端设备执行本说明书上述“示例性方法”部分中描述的根据本发明各种示例性实施方式的步骤。In an exemplary embodiment of the present invention, there is also provided a computer-readable storage medium on which is stored a program product capable of implementing the above-mentioned method in this specification. In some possible implementation manners, various aspects of the present invention may also be implemented in the form of a program product, which includes program code. When the program product runs on a terminal device, the program code is used to make the The terminal device executes the steps according to various exemplary embodiments of the present invention described in the above-mentioned "Exemplary Method" section of this specification.
根据本发明的实施方式的用于实现上述方法的程序产品,其可以采用便携式紧凑盘只读存储器(CD-ROM)并包括程序代码,并可以在终端设备,例如个人电脑上运行。然而,本发明的程序产品不限于此,在本文件中,可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。The program product for implementing the above method according to the embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited to this. In this document, the readable storage medium can be any tangible medium that contains or stores a program, and the program can be used by or combined with an instruction execution system, device, or device.
所述程序产品可以采用一个或多个可读介质的任意组合。可读介质可以是可读信号介质或者可读存储介质。可读存储介质例如可以为但不限于电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。The program product can use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or a combination of any of the above. More specific examples (non-exhaustive list) of readable storage media include: electrical connections with one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable Type programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了可读程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。可读信号介质还可以是可读存储介质以外的任何可读介质,该可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。The computer-readable signal medium may include a data signal propagated in baseband or as a part of a carrier wave, and readable program code is carried therein. This propagated data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. The readable signal medium may also be any readable medium other than a readable storage medium, and the readable medium may send, propagate, or transmit a program for use by or in combination with the instruction execution system, apparatus, or device.
可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于无线、有线、光缆、RF等等,或者上述的任意合适的组合。The program code contained on the readable medium can be transmitted by any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
可以以一种或多种程序设计语言的任意组合来编写用于执行本发明操作的程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、C++等,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算设备上执行、部分地在用户设备上执行、作为一个独立的软件包执行、部分在用户计算设备上部分在远程计算设备上执行、或者完全在远程计算设备或服务器上执行。在涉及远程计算设备的情形中,远程计算设备可以通过任意种类的网络,包括局域网(LAN)或广域网(WAN),连接到用户计算设备,或者,可以连接到外部计算设备(例如利用因特网服务提供商来通过因特网连接)。The program code used to perform the operations of the present invention can be written in any combination of one or more programming languages. The programming languages include object-oriented programming languages—such as Java, C++, etc., as well as conventional procedural styles. Programming language-such as "C" language or similar programming language. The program code can be executed entirely on the user's computing device, partly on the user's device, executed as an independent software package, partly on the user's computing device and partly executed on the remote computing device, or entirely on the remote computing device or server Executed on. In the case of a remote computing device, the remote computing device can be connected to a user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (for example, using Internet service providers). Business to connect via the Internet).
此外,上述附图仅是根据本发明示例性实施例的方法所包括的处理的示意性说明,而不是限制目的。易于理解,上述附图所示的处理并不表明或限制这些处理的时间顺序。另外,也易于理解,这些处理可以是例如在多个模块中同步或异步执行的。In addition, the above-mentioned drawings are merely schematic illustrations of the processing included in the method according to the exemplary embodiment of the present invention, and are not intended for limitation. It is easy to understand that the processing shown in the above drawings does not indicate or limit the time sequence of these processings. In addition, it is easy to understand that these processes can be executed synchronously or asynchronously in multiple modules, for example.
本领域技术人员在考虑说明书及实践这里发明的发明后,将容易想到本发明的其他实施例。本申请旨在涵盖本发明的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本发明的一般性原理并包括本发明未发明的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本发明的真正范围和精神由权利要求指出。Those skilled in the art will easily think of other embodiments of the present invention after considering the description and practicing the invention herein. This application is intended to cover any variations, uses, or adaptive changes of the present invention. These variations, uses, or adaptive changes follow the general principles of the present invention and include common knowledge or customary technical means in the technical field where the present invention is not invented. . The description and embodiments are only regarded as exemplary, and the true scope and spirit of the present invention are pointed out by the claims.

Claims (10)

  1. 一种Web请求处理方法,其特征在于,应用于可配置Wi-Fi参数的Wi-Fi芯片,所述方法包括:A Web request processing method, characterized in that it is applied to a Wi-Fi chip capable of configuring Wi-Fi parameters, and the method includes:
    接收Web请求,为所述Web请求建立连接;Receiving a web request, and establishing a connection for the web request;
    远程调用LUA脚本,选择与所述Web请求对应的处理函数进行处理;Remotely call the LUA script and select the processing function corresponding to the Web request for processing;
    返回处理结果数据。Return processing result data.
  2. 根据权利要求1所述的方法,其特征在于,所述远程调用LUA脚本,选择与所述Web请求对应的处理函数进行处理的步骤包括:The method according to claim 1, wherein the step of remotely invoking an LUA script and selecting a processing function corresponding to the Web request for processing comprises:
    触发receive事件;Trigger the receive event;
    解析请求数据,获取到LUA文件名;Parse the request data and get the LUA file name;
    加载文件获取LUA函数;Load the file to get the LUA function;
    执行LUA函数;Execute LUA function;
    触发sent事件,发送执行所述LUA函数所获取到的结果。The sent event is triggered, and the result obtained by executing the LUA function is sent.
  3. 根据权利要求2所述的方法,其特征在于,所述加载文件获取LUA函数的步骤包括:The method according to claim 2, wherein the step of loading the file to obtain the LUA function comprises:
    采用dofile方式加载文件获取所述LUA函数。The LUA function is obtained by loading a file in a dofile manner.
  4. 根据权利要求1或2所述的方法,其特征在于,所述选择与所述Web请求对应的处理函数进行处理的步骤包括:The method according to claim 1 or 2, wherein the step of selecting a processing function corresponding to the Web request for processing comprises:
    创建与所述Web请求对应的协同程序;Creating a collaborative program corresponding to the Web request;
    为所述协同程序指定处理函数;以及Specify a processing function for the cooperative program; and
    利用所述处理函数进行处理。Use the processing function for processing.
  5. 根据权利要求4所述的方法,其特征在于,所述利用所述处理函数进行处理的步骤包括:The method according to claim 4, wherein the step of using the processing function to perform processing comprises:
    S1231、唤醒协同程序,执行处理函数得到返回数据;S1231, wake up the cooperative program, execute the processing function to get the return data;
    S1232、响应于返回数据需要切片,而进行数据切片;S1232, perform data slicing in response to the need to slice the returned data;
    S1233、响应于获取到阈值个切片,挂起所述协同程序,并发送所述阈值个切片;S1233. In response to acquiring a threshold number of slices, suspend the cooperative program, and send the threshold number of slices;
    S1234、响应于数据未发送完毕,循环执行步骤S1231~S1234。S1234: In response to the data not being sent, steps S1231 to S1234 are cyclically executed.
  6. 根据权利要求4所述的方法,其特征在于,所述利用所述处理函数进行处理的步骤还包括:The method according to claim 4, wherein the step of using the processing function to perform processing further comprises:
    响应于返回数据不需要切片,直接进行数据发送。In response to the returned data, no slicing is required, and the data is sent directly.
  7. 根据权利要求5或6所述的方法,其特征在于,所述利用所述处理函数进行处理的步骤还包括:数据发送后,判断所述协同程序为挂起状态时,关闭所述连接。The method according to claim 5 or 6, wherein the step of using the processing function for processing further comprises: closing the connection when it is determined that the cooperative program is in a suspended state after the data is sent.
  8. 一种Web请求处理装置,其特征在于,应用于可配置Wi-Fi参数的Wi-Fi芯片,所述装置包括:A Web request processing device, characterized in that it is applied to a Wi-Fi chip capable of configuring Wi-Fi parameters, and the device includes:
    连接建立模块,被配置为基于接收到的Web请求,为所述Web请求建立连接;The connection establishment module is configured to establish a connection for the Web request based on the received Web request;
    数据处理模块,被配置为远程调用LUA脚本,选择与所述Web请求对应的处理函数进行处理;The data processing module is configured to remotely call the LUA script and select the processing function corresponding to the Web request for processing;
    发送模块,被配置为返回处理结果数据。The sending module is configured to return processing result data.
  9. 一种电子设备,其特征在于,包括:An electronic device, characterized in that it comprises:
    一个或多个处理器;One or more processors;
    存储装置,用于存储一个或多个程序,Storage device for storing one or more programs,
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-7中任一所述的方法。When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-7.
  10. 一种计算机可读介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现如权利要求1-7中任一所述的方法。A computer readable medium having a computer program stored thereon, wherein the program is executed by a processor to implement the method according to any one of claims 1-7.
PCT/CN2020/083875 2020-04-09 2020-04-09 Web request processing method and apparatus WO2021203343A1 (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
PCT/CN2020/083875 WO2021203343A1 (en) 2020-04-09 2020-04-09 Web request processing method and apparatus
CN202080000785.6A CN111937366B (en) 2020-04-09 2020-04-09 Web request processing method and device
TW110110397A TWI815098B (en) 2020-04-09 2021-03-23 Web request processing method, device, electronic device, and computer-readable recording medium with stored program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/083875 WO2021203343A1 (en) 2020-04-09 2020-04-09 Web request processing method and apparatus

Publications (1)

Publication Number Publication Date
WO2021203343A1 true WO2021203343A1 (en) 2021-10-14

Family

ID=73334984

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/083875 WO2021203343A1 (en) 2020-04-09 2020-04-09 Web request processing method and apparatus

Country Status (3)

Country Link
CN (1) CN111937366B (en)
TW (1) TWI815098B (en)
WO (1) WO2021203343A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114461296A (en) * 2021-12-29 2022-05-10 天翼云科技有限公司 OpenResty-based service platform development and access method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101488143A (en) * 2008-01-16 2009-07-22 重庆安软信息科技有限公司 Novel web application and local application interaction mode
CN105516337A (en) * 2015-12-28 2016-04-20 南京大学金陵学院 Web site docking analysis method based on dynamic loading mechanism
WO2018140487A1 (en) * 2017-01-27 2018-08-02 Mz Ip Holdings, Llc System and method for encapsulating computer communications
CN110545269A (en) * 2019-08-22 2019-12-06 西安四叶草信息技术有限公司 Access control method, device and storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2558923A4 (en) * 2010-04-12 2014-11-19 Google Inc Extension framework for input method editor
CN103036891A (en) * 2012-12-19 2013-04-10 北京时代凌宇科技有限公司 Method and device based on wireless fidelity (Wi-Fi) for accessing to Internet of Things
US9898384B2 (en) * 2016-03-18 2018-02-20 International Business Machines Corporation Automated problem determination for cooperating web services using debugging technology
CN108717285A (en) * 2018-04-14 2018-10-30 张著岳 The programmable logic controller (PLC) programmed by built-in web
CN110392375B (en) * 2018-04-18 2022-02-22 腾讯科技(深圳)有限公司 WiFi network channel modification method, terminal, server and storage medium
CN110545298A (en) * 2018-05-28 2019-12-06 上海驿卓通信科技有限公司 Exhibition hall multi-information acquisition system
CN110875858B (en) * 2018-08-31 2023-06-27 北京京东尚科信息技术有限公司 Application test data grabbing method, system, equipment and storage medium
CN109814915B (en) * 2018-12-29 2022-07-22 天津字节跳动科技有限公司 Parameter configuration method, device, medium and electronic equipment based on lua

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101488143A (en) * 2008-01-16 2009-07-22 重庆安软信息科技有限公司 Novel web application and local application interaction mode
CN105516337A (en) * 2015-12-28 2016-04-20 南京大学金陵学院 Web site docking analysis method based on dynamic loading mechanism
WO2018140487A1 (en) * 2017-01-27 2018-08-02 Mz Ip Holdings, Llc System and method for encapsulating computer communications
CN110545269A (en) * 2019-08-22 2019-12-06 西安四叶草信息技术有限公司 Access control method, device and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114461296A (en) * 2021-12-29 2022-05-10 天翼云科技有限公司 OpenResty-based service platform development and access method
CN114461296B (en) * 2021-12-29 2024-01-02 天翼云科技有限公司 Openresty-based service platform development and access method

Also Published As

Publication number Publication date
TW202139767A (en) 2021-10-16
TWI815098B (en) 2023-09-11
CN111937366B (en) 2023-08-01
CN111937366A (en) 2020-11-13

Similar Documents

Publication Publication Date Title
US11223704B2 (en) Event service for local client applications through local server
CN113626224B (en) NFC data interaction method and device, electronic equipment and storage medium
CN112257135B (en) Model loading method and device based on multithreading, storage medium and terminal
EP3402160B1 (en) Service processing method and apparatus
US10318359B2 (en) Techniques to remotely access object events
CN108418874B (en) Cross-wide-area-network data back-leading method and device, computer equipment and storage medium
WO2021022710A1 (en) Message queue processing method, device, electronic apparatus, and computer readable non-volatile storage medium
JP6088531B2 (en) Event service for local client applications through a local server
WO2021012795A1 (en) Network node scheduling method and apparatus, electronic device and storage medium
WO2021203343A1 (en) Web request processing method and apparatus
WO2023179801A1 (en) Data processing method and apparatus, communication system, electronic device, and storage medium
WO2017166093A1 (en) Front-end system
CN116450554A (en) Interrupt processing method, root complex device and electronic device
US20080313309A1 (en) Client-server data transfer control
WO2021243665A1 (en) Compilation method, compilation apparatus, compilation system, storage medium, and electronic device
KR100494827B1 (en) Distributed object model based radio server with hardware-independent communication interface and communication control method using the same
WO2021057351A1 (en) Apparatus and method for controlling android bluetooth in glibc environment, and terminal device
CN115373865A (en) Concurrent thread management method, device, electronic equipment and storage medium
Wang et al. Design and implementation of remote control system between Android platform
CN116360892B (en) Function expansion method, device, equipment and medium of distributed service system
WO2017166094A1 (en) Server front-end method
WO2017166095A1 (en) Server front-end method
CN112422692A (en) Network request method and related device
WO2017096919A1 (en) Data return method, receiving method, return apparatus, and reception apparatus
CN116360892A (en) Function expansion method, device, equipment and medium of distributed service system

Legal Events

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

Ref document number: 20930210

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20930210

Country of ref document: EP

Kind code of ref document: A1