LensStudio:Network
ModuleBefore using anything in this namespace, make sure to import LensStudio:Network and add network in your plugin's module.json.
Example
// module.json
{
"main": "main.js",
"permissions": ["network"]
}
// main.js
import * as network from 'LensStudio:Network';
Namespaces
| Namespace | Description |
|---|---|
| HttpRequest | - |
Classes
| Class | Description |
|---|---|
| Address | A TCP Server address. Use with "LensStudio:Network".TcpServer. |
| BaseServer | Base class for network servers, providing common listen and connection management functionality. |
| BaseSocket | Base class for network sockets, providing common send and event handling functionality. |
| FormData | Holds key-value pairs and file attachments for encoding multipart HTTP request bodies. |
| HttpReply | Handle to an in-progress HTTP request returned by performHttpRequestWithReply; must be retained to keep the connection alive. |
| HttpRequest | A HTTP Request configuration. Use with "LensStudio:Network".performHttpRequestWithReply. |
| HttpResponse | An HTTP response, received from the callback to performing a request, such as through: "LensStudio:Network".performHttpRequestWithReply, or "LensStudio:RemoteServiceModule".performApiRequest. |
| TcpServer | A class to accept TCP connetions. Useful for receiving streaming data. It's also able to send back responses. |
| TcpSocket | TCP socket for use with "LensStudio:Network".TcpSocket. |
Functions
| Function | Description |
|---|---|
| performAuthorizedHttpRequest | Calls a HTTPS endpoint with authorization to Snapchat. See Editor.IAuthorization. Requires snap_auth_token in module.json of your plugin. |
| performHttpRequest | Calls a HTTP endpoint. |
| performHttpRequestWithReply | Request an HTTP call with reply. You should store the reply object (e.g. in the this of the plugin) in order for the network connection to be maintained. |