Class IdeConnection


@JsType(namespace="dh") public class IdeConnection extends QueryConnectable<IdeConnection>
Presently, this is the entrypoint into the Deephaven JS API. By creating an instance of this with the server URL and some options, JS applications can run code on the server and interact with available exportable objects.
  • Field Details

  • Constructor Details

    • IdeConnection

      @JsIgnore public IdeConnection(String serverUrl, Object connectOptions)
      Creates a new instance, from which console sessions can be made.
      Parameters:
      serverUrl - The url used when connecting to the server. Read-only.
      connectOptions - Optional Object
  • Method Details

    • logPrefix

      protected String logPrefix()
      Overrides:
      logPrefix in class HasEventHandling
    • getToken

      @JsIgnore public ConnectToken getToken()
      Specified by:
      getToken in class QueryConnectable<IdeConnection>
    • getOptions

      @JsIgnore public ConnectOptions getOptions()
      Specified by:
      getOptions in class QueryConnectable<IdeConnection>
    • close

      public void close()
      Closes the current connection, releasing any resources on the server or client.
      Overrides:
      close in class QueryConnectable<IdeConnection>
    • getServerUrl

      @JsIgnore public String getServerUrl()
      The url used when connecting to the server.
      Overrides:
      getServerUrl in class QueryConnectable<IdeConnection>
      Returns:
      String.
    • running

      public elemental2.promise.Promise<IdeConnection> running()
      Description copied from class: QueryConnectable
      Promise that resolves when this worker instance can be connected to, or rejects if it can't be used.
      Specified by:
      running in class QueryConnectable<IdeConnection>
      Returns:
      A promise that resolves with this instance.
    • getTable

      @Deprecated public JsPendingTable<JsTable> getTable(String name, @JsOptional @JsNullable Boolean applyPreviewColumns)
      Deprecated.
      Added to resolve a specific issue, in the future preview will be applied as part of the subscription.
      Load the named table, with columns and size information already fully populated.
      Parameters:
      name - the name of the table to fetch.
      applyPreviewColumns - false to disable previews. Defaults to true.
      Returns:
      the table, as a pending table that rejects with an error if it cannot be loaded
    • getObject

      public JsPendingObject getObject(@TsTypeRef(JsVariableDescriptor.class) @TsTypeRef(JsVariableDescriptor.class) jsinterop.base.JsPropertyMap<Object> definitionObject)
      Fetches the object a variable descriptor names.
      Parameters:
      definitionObject - the variable descriptor
      Returns:
      a pending table if the object is a table, otherwise a promise of the object
    • subscribeToFieldUpdates

      public JsRunnable subscribeToFieldUpdates(JsConsumer<JsVariableChanges> callback)
    • shareObject

      public elemental2.promise.Promise<SharedExportBytesUnion> shareObject(ServerObject.Union object, SharedExportBytesUnion sharedTicketBytes)
      Makes an object available to another user or another client on this same server which knows the value of the sharedTicketBytes. Use that sharedTicketBytes value like a one-time use password - any other client which knows this value can read the same object.

      Shared objects will remain available using the sharedTicketBytes until the client that first shared them releases/closes their copy of the object. Whatever side-channel is used to share the bytes, be sure to wait until the remote end has signaled that it has successfully fetched the object before releasing it from this client. A pending table that nothing awaits is released once its result arrives and the share has been made, so keep it by awaiting it, or share the table that awaiting gives.

      Be sure to use an unpredictable value for the shared ticket bytes, like a UUID or other large, random value to prevent access by unauthorized clients.

      Parameters:
      object - The object to share with another client/user.
      sharedTicketBytes - The value which another client/user must know to obtain the object. It may be a unicode string (will be encoded as utf8 bytes), or a Uint8Array value.
      Returns:
      A promise that will resolve to the value passed as sharedTicketBytes when the object is ready to be read by another client, or will reject if an error occurs.
    • getSharedObject

      public JsPendingObject getSharedObject(SharedExportBytesUnion sharedTicketBytes, String type)
      Reads an object shared by another client to this server with the sharedTicketBytes. Until the other client releases this object (or their session ends), the object will be available on the server.

      The type of the object must be passed so that the object can be read from the server correct - the other client should provide this information.

      Parameters:
      sharedTicketBytes - The value provided by another client/user to obtain the object. It may be a unicode string (will be encoded as utf8 bytes), or a Uint8Array value.
      type - The type of the object, so it can be correctly read from the server.
      Returns:
      the shared object, as a pending object that rejects with an error if it cannot be read
    • notifyServerShutdown

      @JsIgnore public void notifyServerShutdown(TerminationNotificationResponse success)
      Specified by:
      notifyServerShutdown in class QueryConnectable<IdeConnection>
    • newTable

      public JsPendingTable<JsTable> newTable(String[] columnNames, String[] types, String[][] data, String userTimeZone)
      Creates a table on the server from the given column data.
      Parameters:
      columnNames - the name of each column
      types - the type of each column
      data - the values of each column, as strings
      userTimeZone - the time zone to read date-time values in
      Returns:
      the new table, as a pending table
    • mergeTables

      public JsPendingTable<JsTable> mergeTables(elemental2.core.ReadonlyArray<JsTableReference> tables)
      Merges the given tables into a single table. Assumes all tables have the same structure.
      Parameters:
      tables - the tables to merge, which must have the same columns and be from this connection
      Returns:
      the merged table, as a pending table