@WebSocket public class StorageMessagingWebSocket extends WebClientProtocol
| Modifier and Type | Class and Description |
|---|---|
private static class |
StorageMessagingWebSocket.IncomingMessage
Represents the message received by the WebSocket
|
private static class |
StorageMessagingWebSocket.StorageMessageType
Supported types of storage access messages.
|
WebClientProtocol.MessagesCollector| Modifier and Type | Field and Description |
|---|---|
private int |
broadcastChannelPongTimeout
The max amount of seconds to send the ping msg to the BroadcastChannel and receive back a response.
|
static int |
DEFAULT_BROADCAST_CHANNEL_PING_TIMEOUT_SEC
The default max amount of seconds to send the ping msg to the BroadcastChannel and receive back a
response.
|
private static java.lang.String |
JSON_KEY_KEY
JSON object key in outgoing messages.
|
private static java.lang.String |
JSON_KEY_MSGID
JSON object key in outgoing messages.
|
private static java.lang.String |
JSON_KEY_TYPE
JSON object key in outgoing messages.
|
private static java.lang.String |
JSON_KEY_VALUE
JSON object key in outgoing messages.
|
private static CentralLogger |
LOG
Logger
|
private int |
nextMessageId
The next message ID, used to track message request which require an immediate response
from the JS side.
|
callbacks, isVT100, lockCAPTURE_MOUSE, ENABLE_OS_EVENTS, MSG_ADD_WINDOW_MESSAGE_TEXT, MSG_BEEP, MSG_CLEAR, MSG_CLEAR_WINDOW_MESSAGES, MSG_CLIENT_READY, MSG_CLIPBOARD_ASK_FOR_PASTE, MSG_CLIPBOARD_CONTENTS, MSG_CLIPBOARD_PREPARE, MSG_CLIPBOARD_SOFT_PASTE_READY, MSG_CREATE_CHILD_WINDOW, MSG_CREATE_FONT, MSG_CREATE_WIDGET, MSG_CREATE_WINDOW, MSG_CURRENT_SELECTION, MSG_CURSOR_POS, MSG_CURSOR_STATUS, MSG_DELETE_KEY_VALUE, MSG_DEREGISTER_WIDGET, MSG_DERIVE_FONT, MSG_DESKTOP_RESIZED, MSG_DESTROY_WIDGET, MSG_DESTROY_WINDOW, MSG_DISABLE_GRAPHICS_CACHE, MSG_DONE_CREATE_FONT, MSG_DONE_DERIVE_FONT, MSG_DRAW, MSG_DRAW_HASH_REMOVED, MSG_DROP_FILE_NOTIFY, MSG_ENABLE_GRAPHICS_CACHE, MSG_FILE_CHOOSE, MSG_FILE_UPLOADING, MSG_FORK_NEW_SESSION, MSG_GET_BROWSER_DETAILS, MSG_GET_DESKTOP_DIMENSION, MSG_GET_FONT_HEIGHT, MSG_GET_FONT_WIDTHS, MSG_GET_HOST_BY_NAME, MSG_GET_HOST_NAME, MSG_GET_KEY_VALUE, MSG_GET_MOUSE_POSITION, MSG_GET_PAR_HEIGHT, MSG_GET_TEXT_HEIGHT, MSG_GET_TEXT_WIDTH, MSG_GET_TEXT_WIDTHS, MSG_GET_TEXT_WIDTHS_BATCH, MSG_GET_WEB_BASIC_PALETTE, MSG_HELPER_APPLICATIONS, MSG_HTML_BROWSER_LOAD_TIMEOUT, MSG_INVALIDATE_SELECTION, MSG_INVOKE_WIDGET_COMMAND, MSG_IS_FONT_INSTALLED, MSG_KEY, MSG_KEY_VT100, MSG_KEYBOARD_LAYOUTS, MSG_LOCK_MOUSE_PTR, MSG_MOUSE_EVENT, MSG_MOVE_TO_BOTTOM, MSG_MOVE_TO_TOP, MSG_MULTIPLEX, MSG_NET_TEST, MSG_OPEN_MIME_RESOURCE, MSG_OS_KEY, MSG_OS_LL_MESSAGE, MSG_P2J_APPLY_EVENT, MSG_P2J_CREATE_RESOURCE, MSG_P2J_DELETE_HANDLE, MSG_P2J_INVOKE, MSG_P2J_PUBLISH, MSG_P2J_SUBSCRIBE, MSG_P2J_UNSUBSCRIBE, MSG_PAGE_LOADED, MSG_PARSE_EDITOR_CONTENT, MSG_PARTIAL, MSG_PASTE, MSG_PING_ANY_CHANNEL, MSG_PING_CHANNEL, MSG_PING_PONG, MSG_PING_WITH_TIMEOUT, MSG_PLACE_WIDGET, MSG_QUIT, MSG_READ_CLIPBOARD, MSG_REFRESH_HOVER, MSG_REGISTER_CHANNEL, MSG_REGISTER_HOVERABLE_WIDGET, MSG_REMOTE_CALL, MSG_REMOVE_EXPIRED_HASH, MSG_REMOVE_GLOBAL_CURSOR, MSG_RESTACK_WINDOWS, MSG_SENT_DESKTOP_DIMENSION, MSG_SENT_FONT_HEIGHT, MSG_SENT_FONT_WIDTHS, MSG_SENT_HOST_BY_NAME, MSG_SENT_HOST_NAME, MSG_SENT_PAR_HEIGHT, MSG_SENT_TEXT_HEIGHT, MSG_SENT_TEXT_WIDTH, MSG_SENT_TEXT_WIDTHS, MSG_SENT_TEXT_WIDTHS_BATCH, MSG_SET_CURSOR_STYLE, MSG_SET_GLOBAL_CURSOR, MSG_SET_KEY_VALUE, MSG_SET_LISTENING_OS_MESSAGES, MSG_SET_MOUSE_PTR, MSG_SET_UPLOAD_FILE_SIZE_LIMITS, MSG_SET_WAIT_STATE, MSG_SET_WIDGET_ATTRIBUTE, MSG_SET_WIDGET_SENSITIVITY, MSG_SET_WIDGET_VISIBILITY, MSG_SET_WINDOW_LOC, MSG_SET_WINDOW_STATUS_TEXT, MSG_TRANSLATIONS, MSG_TRIGGER_EVENT, MSG_VT100, MSG_WAIT_USER_INPUT, MSG_WIDGET_CONTENT_LOADED, MSG_WIDGET_WEB_MESSAGE, MSG_WINDOW_ACTIVATED, MSG_WINDOW_ICONIFY, MSG_WINDOW_RESIZED, MSG_WINDOW_SENSITIVITY, MSG_WINDOW_VISIBILITY, MSG_WRITE_CLIPBOARD, PASS_CHANGE, PROCESS_INTERACTIVE_WIDGETS, SET_ICONIFICATION_STATE, SET_RESIZEABLE_WINDOW| Constructor and Description |
|---|
StorageMessagingWebSocket(java.lang.Object lock,
ClientProtocolHooks callbacks,
long timeout,
long wdtimeout,
int broadcastChannelPingTimeout)
Create a instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
deleteKeyAndValue(java.lang.String key)
Deletes the given key and its value from the browser local storage.
|
boolean |
findAnyIdInChannel(java.lang.String channelName,
java.util.List<java.lang.String> channelIds)
Searches for the specified channel instances and returns
true if any found,
false otherwise. |
BrowserDetails |
getBrowserDetails()
Returns the browser details for web drivers.
|
private java.lang.String |
getResponse(int msgId,
long timeout)
Waits for the result to the message with the corresponding id, then parses the result that is
expected to be of type
StorageMessagingWebSocket.IncomingMessage and returns the response value or throws an exception
of type ErrorConditionException, if the result contains an error or is not in the expected
format. |
java.lang.String |
getStringValue(java.lang.String key)
Gets the string value of the given key from the browser local storage.
|
protected int |
nextMessageId()
Get the next message ID.
|
boolean |
pingBroadcastChannel(java.lang.String channelName,
java.lang.String targetChannelId)
Returns if the target broadcast channel responds with pong.
|
boolean |
pingOnWebSocket()
Check if the WebSocket connection is alive.
|
boolean |
processBinaryMessage(byte[] message,
int offset,
int length)
This is the worker method which is called when a binary message is received.
|
void |
registerBroadcastChannel(java.lang.String channelName,
java.lang.String channelId)
Opens a broadcast channel in the client's front-end.
|
OsPassChangeInput |
retryPassChangeOnError(java.lang.String osUserName,
java.lang.String errMsg)
Shows an error message in the OS pass change process and retries to receive new pass.
|
void |
setStringValue(java.lang.String key,
java.lang.String value)
Sets the value of the given key into the browser local storage.
|
OsPassChangeInput |
showChangePasswordDialog(java.lang.String osUserName,
boolean isModal)
Shows a dialog to allow the change of the OS account password.
|
void |
showSuccessfulPassChange()
Shows that the OS pass has been changed successfully on the front-end and hide the dialog.
|
beep, getBrowserWebSocket, getMessagesCollector, injectKey, onClose, onConnect, onError, onMessage, onMessage, parseJSON, paste, processChannel, processTextMessage, quit, readByteArray, readKey, readMessageInt16, readMessageInt32, readMessageInt64, readMessageText, receiveResult, sendBinaryMessage, sendBinaryMessage, sendBinaryMessage, sendBinaryMessage, sendBinaryMessage, sendBinaryMessage, sendBinaryMessageSync, sendHelperApplications, sendKeyboardLayouts, sendSwitchMode, sendTextMessage, sendTranslationResources, swapKeyboardMode, toJSON, waitForResult, waitForResult, writeMessageFloat64, writeMessageInt16, writeMessageInt32, writeMessageTextpublic static final int DEFAULT_BROADCAST_CHANNEL_PING_TIMEOUT_SEC
private static final CentralLogger LOG
private static final java.lang.String JSON_KEY_MSGID
private static final java.lang.String JSON_KEY_TYPE
private static final java.lang.String JSON_KEY_KEY
private static final java.lang.String JSON_KEY_VALUE
private final int broadcastChannelPongTimeout
private int nextMessageId
public StorageMessagingWebSocket(java.lang.Object lock,
ClientProtocolHooks callbacks,
long timeout,
long wdtimeout,
int broadcastChannelPingTimeout)
lock - Object to use for locking. By passing this in, the caller can share the
locking instance with this code. Use null if an internal
lock object should be created.callbacks - An instance with hooks to call at specific events.timeout - Web socket timeout.wdtimeout - Watchdog thread timeout.broadcastChannelPingTimeout - The max amount of seconds to send the ping msg to the BroadcastChannel and receive back a
response.public boolean processBinaryMessage(byte[] message,
int offset,
int length)
processBinaryMessage in class WebClientProtocolmessage - Message content as an byte array.offset - Message offset..length - Message size.true if the message has been handled, false otherwise.public java.lang.String getStringValue(java.lang.String key)
key - The given keypublic void setStringValue(java.lang.String key,
java.lang.String value)
key - The given keyvalue - The key value to be stored into the browser local storage.public void deleteKeyAndValue(java.lang.String key)
key - The given keypublic void registerBroadcastChannel(java.lang.String channelName,
java.lang.String channelId)
channelName - The name of the channel. The same for all instances of the app. Usually package root.channelId - The ID of the channel. Unique for this instance of the app. Usually session ID.public boolean pingBroadcastChannel(java.lang.String channelName,
java.lang.String targetChannelId)
channelName - The name of the channel. The same for all instances of the app. Usually package root.targetChannelId - The id of the target channel. Unique for this instance of the app. Usually session ID.true if the target broadcast channel responds with pong,
false otherwise.public boolean findAnyIdInChannel(java.lang.String channelName,
java.util.List<java.lang.String> channelIds)
true if any found,
false otherwise.channelName - The broadcast channel name.channelIds - A list of channel ids to check for.true if any of the channel instances found, false otherwise.public boolean pingOnWebSocket()
true if the websocket connection is alive, false otherwise.public BrowserDetails getBrowserDetails()
public OsPassChangeInput showChangePasswordDialog(java.lang.String osUserName, boolean isModal)
osUserName - The OS account name.public void showSuccessfulPassChange()
public OsPassChangeInput retryPassChangeOnError(java.lang.String osUserName, java.lang.String errMsg)
errMsg - The error message.protected int nextMessageId()
private java.lang.String getResponse(int msgId,
long timeout)
StorageMessagingWebSocket.IncomingMessage and returns the response value or throws an exception
of type ErrorConditionException, if the result contains an error or is not in the expected
format.msgId - The message id.timeout - The maximum time to wait in milliseconds. 0 for indefinitely.ErrorConditionException - An exception for invalid response or error returned by localStorage.