This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
component:internet [2015/06/16 20:37] gamax92 Add documentation about TCP object and HTTP object |
component:internet [2019/04/17 21:09] rahix Add id() and the internet_ready event |
||
---|---|---|---|
Line 12: | Line 12: | ||
- `connect(address:string[, port:number]):userdata` | - `connect(address:string[, port:number]):userdata` | ||
Opens a new TCP connection. Returns the handle of the connection. | Opens a new TCP connection. Returns the handle of the connection. | ||
- | - `request(url:string[, postData:string]):userdata` | + | - `request(url:string[, postData:string[, headers:table]]):userdata` |
Sends a new HTTP request. Returns the handle of the connection. | Sends a new HTTP request. Returns the handle of the connection. | ||
Line 25: | Line 25: | ||
- `finishConnect():boolean` | - `finishConnect():boolean` | ||
Ensures a socket is connected. Errors if the connection failed. | Ensures a socket is connected. Errors if the connection failed. | ||
+ | - `id():string` | ||
+ | Returns the id for this socket. | ||
+ | After calling `finishConnect` or `read`, this socket generates a signal named `internet_ready` whenever new data is available to be read. It has one parameter which is the socket id. | ||
==== HTTP Request Object ==== | ==== HTTP Request Object ==== | ||