Class: Client

Client(url, optionsopt)

A Client contains methods to send messages to a Gremlin Server.

Constructor

new Client(url, optionsopt)

Creates a new instance of Client.
Parameters:
Name Type Attributes Description
url String The resource uri.
options Object <optional>
The connection options.
Properties
Name Type Attributes Description
ca Array <optional>
Trusted certificates.
cert String | Array | Buffer <optional>
The certificate key.
mimeType String <optional>
The mime type to use.
pfx String | Buffer <optional>
The private key, certificate, and CA certs.
reader GraphSONReader <optional>
The reader to use.
rejectUnauthorized Boolean <optional>
Determines whether to verify or not the server certificate.
traversalSource String <optional>
The traversal source. Defaults to: 'g'.
writer GraphSONWriter <optional>
The writer to use.
authenticator Authenticator <optional>
The authentication handler to use.
processor String <optional>
The name of the opProcessor to use, leave it undefined or set 'session' when session mode.
session String <optional>
The sessionId of Client in session mode. Defaults to null means session-less Client.
Source:

Members

isOpen

Returns true if the underlying connection is open
Source:

Methods

addListener(event, handler)

Adds an event listener to the connection
Parameters:
Name Type Description
event String The event name that you want to listen to.
handler function The callback to be called when the event occurs.
Source:

close() → {Promise}

Closes the underlying connection send session close request before connection close if session mode
Source:
Returns:
Type
Promise

open() → {Promise}

Opens the underlying connection to the Gremlin Server, if it's not already opened.
Source:
Returns:
Type
Promise

removeListener(event, handler)

Removes a previowsly added event listener to the connection
Parameters:
Name Type Description
event String The event name that you want to listen to.
handler function The event handler to be removed.
Source:

submit(message, bindingsopt, requestOptionsopt) → {Promise}

Send a request to the Gremlin Server, can send a script or bytecode steps.
Parameters:
Name Type Attributes Description
message Bytecode | string The bytecode or script to send
bindings Object <optional>
The script bindings, if any.
requestOptions Object <optional>
Configuration specific to the current request.
Properties
Name Type Attributes Description
requestId String <optional>
User specified request identifier which must be a UUID.
batchSize Number <optional>
The size in which the result of a request is to be "batched" back to the client
userAgent String <optional>
A custom string that specifies to the server where the request came from.
evaluationTimeout Number <optional>
The timeout for the evaluation of the request.
Source:
Returns:
Type
Promise