This servide provides ability for send http request.
It is implemented by Request.
url: String. Http request url. If the url does not start with http://, it will be added with http://.
method: String. Request method. Now only get,post,put,delete,patch` are supported.
headers: Object. Request headers. Default is {}.
body: Object. Request body. Default is {}.
proxy: String. Optional. You can set the proxy manually.
timeout: Number. Request timeout. Default is 50000(50s).
switch: Boolean. The switching signal of http request. If it's true, this service will send request and format response data.
out: String. The http reuquest result including statusCode,headers,body
In this example, we send request to http://www.baidu.com and write the response body to file.
{
"statusCode": 200,
"headers": "response.headers",
"body": "response.body"
}This servide provides ability for send tcp request.
ip: String. Server ip.
port: Number. Server port.
switch: Boolean. The switching signal of tcp request. If it's true, this service will send request and format response data.
data: String. The message send to server.
out: String. Data response from server.
In this example, every 3 second, we send request to 127.0.0.1:9999 and show response data with Text widget.
This servide provides ability for create a simple tcp server.
ip: String. Listening ip. Default is 0.0.0.0
port: Number. Listening port.
f(data): Function. Deal with the data from cilent.
switch: Boolean. The switching signal of tcp server. If it's true, this server will be alive otherwise the server will be closed.
In this example, we create a tcp server listening on 0.0.0.0:9999. When cilent send data, we simply append "hello" to it.
function code
return data.toString() + "hello";This servide provides ability for send udp request.
ip: String. Server ip.
port: Number. Server port.
switch: Boolean. The switching signal of udp request. If it's true, this service will send request and format response data.
data: String. The message send to server.
out: String. Data response from server.
See tcp request example.
This servide provides ability for create a simple udp server.
ip: String. Listening ip. Default is 0.0.0.0
port: Number. Listening port.
f(data): Function. Deal with the data from cilent.
switch: Boolean. The switching signal of udp server. If it's true, this server will be alive otherwise the server will be closed.
See tcp server example.