TCP Input Context

  • Context Variable: service
  • Only applicable to TCP Input

API Interface

//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);

//Stops the input service
void stop();

//Gets the input service's config ID
String getId();

//Gets the input service's domain key
String getDomainKey();

//Retrieves the entity type [DOMAIN, ORGANIZATION, GLOBAL, SYSTEM]
EntityType getEntityType();

//Gets the input service's org id 
Long getOrgId();

Related Context APIs

Inputs Context
TCP Context
Context Base

Example

def content = "Your broadcast data";
inputs.getTcp("MY_TCP_INPUT_ID").broadcast(content);