TCP Context
- Only applicable for TCP Input
TCP Input Service API
- Context Variable: service
//Send a string content to a socket client
void write(String clientId, String content);
//Send a byte array to a socket client
void write(String clientId, byte[] data);
//Close a socket client
void close(String clientId);
//Close all socket clients
void closeAll();
//Broadcast a byte array to all connected socket clients
void broadcast(byte[] data);
//Broacast a string content to all connected clients
void broadcast(String content);
- TCP input services can be accessed using Inputs Context
- Example
- inputs.getTcp("SERVICE_ID").broadcast("Hello Client");
TCP Context API
- Context Variable: tcp
//Send a string content to a socket client
void write(String clientId, String content);
//Send a byte array to a socket client
void write(String clientId, byte[] data);
//Broadcast a byte array to all connected socket clients
void broadcast(byte[] data);
//Broadcast a string content to all connected socket clients
void broadcast(String conent);
//Send a string content
void reply(String content);
//Send a byte array
void reply(byte[] data);
//Get the socket ID
String getId();
Context APIs Inherited
Updated over 3 years ago