public class DesktopConnection extends Object
| Constructor and Description |
|---|
DesktopConnection(String uuid,
String host,
int port)
Creates a new connection to AppDesktop
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEventCallback(org.json.JSONObject subscriptionObject,
EventListener listener,
AckListener callback,
Object source)
Registers an event listener on the specified event
|
void |
addExternalMessageHandler(ExternalMessageListener listener,
Object source)
Registers a listener to handle messages for this connection's UUID originating via HTTPS/HTTP
|
void |
connect(DesktopStateListener listener)
Connects to an AppDesktop process
|
void |
connect(String type,
DesktopStateListener listener)
Connects to an AppDesktop process
|
void |
disconnect()
Disconnects from AppDesktop
|
void |
exit()
Notify AppDesktop to exit
|
InterApplicationBus |
getInterApplicationBus()
Gets the Inter-Application message dispatcher associated with this DesktopConnection
|
boolean |
isConnected()
InterApplicationBus
|
void |
launchAndConnect(String desktopPath,
String commandLineArguments,
DesktopStateListener listener,
int timeout)
Launches AppDesktop and notifies the listener when connected
|
Integer |
registerNotificationListener(NotificationListener listener,
Object source)
Registers listener for a new notification
|
void |
removeEventCallback(org.json.JSONObject subscriptionObject,
EventListener listener,
AckListener callback,
Object source)
Removes a previously registered event listener from the specified event
|
protected void |
respondToPing(long pingId) |
void |
sendAction(String action,
org.json.JSONObject payload)
Sends a message to AppDesktop
|
void |
sendAction(String action,
org.json.JSONObject payload,
AckListener listener,
Object source)
Sends a message to AppDesktop
|
void |
sendActionToNotificationsCenter(String action,
org.json.JSONObject payload,
AckListener callback,
Object source) |
public DesktopConnection(String uuid, String host, int port) throws DesktopError
uuid - unique ID for AppDesktop to refer to this DesktopConnectionhost - The host that AppDesktop is running onport - The port that AppDesktop is listening on for connectionsDesktopErrorpublic void launchAndConnect(String desktopPath, String commandLineArguments, DesktopStateListener listener, int timeout)
desktopPath - Absolute path to the AppDesktop executablecommandLineArguments - Command line arguments to start the AppDesktop withlistener - Receives updates on startup and connection statetimeout - For connecting to Desktop after launch. If the connection to AppDesktop is not established by the timeout the listener will get an onError() callpublic void disconnect()
public boolean isConnected()
public void exit()
public InterApplicationBus getInterApplicationBus()
public void sendAction(String action, org.json.JSONObject payload)
action - The action of the messagepayload - The message object to sendpublic void sendAction(String action, org.json.JSONObject payload, AckListener listener, Object source)
action - The action of the messagepayload - The message object to sendlistener - AckListener for the messagesource - Message sourceAckListenerpublic void connect(DesktopStateListener listener)
listener - Receives updates on startup and connection stateDesktopStateListenerpublic void connect(String type, DesktopStateListener listener)
type - Describes the type of connection to establishlistener - Receives updates on startup and connection stateDesktopStateListenerpublic Integer registerNotificationListener(NotificationListener listener, Object source)
listener - NotificationListener for the notificationsource - Source of the requestNotificationListenerpublic void sendActionToNotificationsCenter(String action, org.json.JSONObject payload, AckListener callback, Object source)
public void addEventCallback(org.json.JSONObject subscriptionObject,
EventListener listener,
AckListener callback,
Object source)
subscriptionObject - JSON object containing subscription information such as the topic and typelistener - EventListener for the eventcallback - AckListener for this requestsource - Source of this requestEventListener,
AckListenerpublic void removeEventCallback(org.json.JSONObject subscriptionObject,
EventListener listener,
AckListener callback,
Object source)
subscriptionObject - JSON object containing subscription information such as the topic and typelistener - EventListener that was registered beforecallback - AckListener for this requestsource - source of this requestprotected void respondToPing(long pingId)
public void addExternalMessageHandler(ExternalMessageListener listener, Object source)
listener - process a received HTTPS/HTTP message for this connectionsource - The object that originally registered the listenerCopyright © 2014. All rights reserved.