A complete map of ConnectionOptions to values.
Type of the factory function to create a new conversation set
The credentials that a session uses to authenticate itself
A callback that should initiate a deregistration from the server
Field model data Record V2 field schema data
Typically created from a schema using {@link FieldData.modelValue}.
This type can be serialised and deserialised to JSON
The maximum number of occurrences of the node within its parent
The minimum number of occurrences of the node within its parent
The name of the field
An optional scale for decimal field types
The datatype of the field
The source type for reading integers
A factory function creating internal update streams that act as a delegate
Alias for the JSON interface to keep compatibility with old TypeScript definitions
Alias for the JSONDataType interface to keep compatibility with old TypeScript definitions
A callback that is called when a Message is successfully parsed
A function definition for sending a message
Record data stored as array of field model data Record V2 record schema data
Typically created from a schema using RecordImpl.createModel.
This type can be serialised and deserialised to JSON
The schema data of the fields contained in the record
The maximum number of occurrences of the node within its parent
The minimum number of occurrences of the node within its parent
The name of the field
A map of serialisers indexed by their value type
Client service
Request handler
the internal session
the request that was received
a service callback to handle the response
A callback function for a service
A listener callback that listens to service commands
Alias for the Options interface to keep compatibility with old TypeScript definitions
A callback function type for Streams
Permissions that are applied on a path Permissions that are applied on a path
Emitted when the Stream has been closed through completion or the underlying session has been closed. No further events will be emitted after this.
Emitted when an error occurs in the Stream or in any of its listeners. No further events will be emitted after this.
the error that occurred
An AuthenticatorResponse that abstains
The AddAndSetTopicRequestSerialiser singleton
The AddTopicResultSerialiser singleton
The ApplyJsonPatchRequestSerialiser singleton
The AuthenticatorRegistrationParametersSerialiser singleton
The AuthenticatorRegistrationRequestSerialiser singleton
The AuthenticatorRequestSerialiser singleton
The AuthenticatorResponseSerialiser singleton
A unique binary delta type instance to calculate deltas of BinaryImpl A unique binary delta type instance to calculate deltas of JSONImpl A unique binary delta type instance to calculate deltas of RecordV2Impl
The BooleanSerialiser singleton
The BufferSerialiser singleton
The BytesSerialiserClass singleton
The CIDSerialiser singleton
The amount of time to wait for the server to close the connection after a req is sent.
The amount of time waiting for a connection to occur.
The ChangeAuthorisationRolesFilterRequestSerialiser singleton
The ChangeAuthorisationRolesRequestSerialiser singleton
The ChangePrincipalRequestSerialiser singleton
The CheckRemoteServerResultSerialiser singleton
The ClientFilterSubscribeRequestSerialiser singleton
The ClientFilterSubscribeResponseSerialiser singleton
The ClientSubscribeRequestSerialiser singleton
The {@link SecurityCommandScriptResultSerialiser} singleton
The CommandHeaderSerialiser singleton
The ControlGroupSerialiser singleton
The ControlRegistrationParamsSerialiser singleton
The CountOrParserErrorsSerialiser singleton
The CreateRemoteServerResultSerialiser singleton
The CreateTopicViewResultSerialiser singleton
The CreateUpdateStreamAndSetRequestSerialiser singleton
The CreateUpdateStreamRequestSerialiser singleton
The CreateUpdateStreamResponseSerialiser singleton
A default Control Group
A unique range covering the complete time series
A default range query
An AuthenticatorResponse that denies authenticator
An enum like object containing descendant qualifiers
An empty JSONPointerMap
Byte indicating an empty field
String representation of a byte indicating an empty field
The EntriesFetchRequestSerialiser singleton
The EntriesFetchResponseSerialiser singleton
The ErrorReasonSerialiser singleton
The ErrorReportListSerialiser singleton
The ErrorReportSerialiser singleton
The EventMetadataImplSerialiser singleton
Delimiter byte for fields
String representation of a delimiter byte for fields
Byte indicating a single field
String representation of a byte indicating a single field
The FetchQueryResultSerialiser singleton
The {@link FetchRequestSerialiser} singleton
The GetSessionPropertiesRequestSerialiser singleton
The GetSessionPropertiesResponseSerialiser singleton
The singleton
The JsonPatchResultSerialiser singleton
The ListGlobalPermissionsResultSerialiser singleton
The ListPathPermissionsResultSerialiser singleton
The ListRemoteServersResultSerialiser singleton
The ListTopicViewsResultSerialiser singleton
Maximum 32 bit integer value: 2^32 - 1
Maximum safe integer value for JavaScript numbers: 2^53 - 1
The singleton
Bitmask for the message type
The singleton
The MessageReceiverControlRegistrationParamsSerialiser singleton
The MessageReceiverControlRegistrationRequestSerialiser singleton
The MessagingClientForwardSendRequest singleton
The MessagingClientSendRequest singleton
The MessagingFilterResponseSerialiser singleton
The MessagingFilterSendRequestSerialiser singleton
The MessagingFilterSendResponseSerialiser singleton
The MessagingResponseSerialiser singleton
The MessagingSendRequestSerialiser singleton
The singleton
The MissingTopicRequestSerialiser singleton
A generator for creating sequential adapter IDs across an arbitrary number of stream registries.
A generator for creating sequential conversation IDs across an arbitrary number of conversation sets.
Global no-change constant Instance of the NoChange RecordV2 delta
The NamedTopicViewSpecificationSerialiser singleton
A special conversation ID for one-way conversations
The topic path separator character.
Delimiter byte for records
String representation of a delimiter byte for records
Byte indicating a single record
String representation of a byte indicating a single record
The default recovery buffer index size
JSONPointer representing the root
The RangeQueryRequestSerialiser singleton
The RangeQueryResultSerialiser singleton
The RemoteServerDefinitionSerialiserClass singleton
The RemoveTopicSerialiser singleton
The ReplaceLicenceResponseSerialiser singleton
The ResponseCommandHeaderSerialiser singleton
A unique start point
The SecurityCommandScriptSerialiser singleton
The SecurityConfigurationSerialiser singleton
The singleton
The BooleanSerialiser singleton
The SessionLockAcquisitionSerialiser singleton
The SessionLockRequestSerialiser singleton
The singleton
The singleton
The SessionPropertiesEventBatchSerialiser singleton
The SessionPropertiesEventSerialiser singleton
The SessionPropertyValidationSerialiser singleton
The SetClientConflationFilterRequestSerialiser singleton
The SetClientConflationRequestSerialiser singleton
The SetSessionPropertiesFilterRequestSerialiser singleton
The SetSessionPropertiesListenerSerialiser singleton
The SetSessionPropertiesRequestSerialiser singleton
The SetSessionPropertiesResultSerialiser singleton
The SetTopicRequestSerialiser singleton
The StringSerialiser singleton
Support the detection and creation of WebSocket and XmlHttpRequest objects in an environment independent way. Each subtransport object provides an enabled field that indicates if the subtransport works and if it works the environment specific constructor for the object.
The subtransports will be looked up by transport name.
The SystemAuthenticationConfigurationSerialiser singleton
The SystemPrincipalSerialiser singleton
How many bits of a timestamp to discard. The default rounds to approximately 1 second.
The buffer length os a session token
The TimeSeriesAppendRequestSerialiser singleton
The TimeSeriesEditRequestSerialiser singleton
The TimeSeriesTimestampAppendRequestSerialiser singleton
The TopicAddRequestSerialiser singleton
The TopicAddResponseSerialiser singleton
The TopicControlRegistrationParamsSerialiser singleton
The TopicControlRegistrationRequestSerialiser singleton
The singleton
The singleton
The TopicNotificationDeregistrationRequestSerialiser singleton
The TopicNotificationDescendantEventSerialiser singleton
The TopicNotificationDeselectionSerialiser singleton
The TopicNotificationEventSerialiser singleton
The TopicNotificationSelectionSerialiser singleton
The TopicSelectorSerialiser singleton
The TopicSpecificationInfoSerialiser singleton
The TopicWillParametersSerialiser singleton
The UnsubscriptionNotificationSerialiser singleton
The UpdateStreamAddTopicRequestSerialiser singleton
The UpdateStreamAddTopicResponseSerialiser singleton
The UpdateStreamIdSerialiser singleton
The UpdateStreamRequestSerialiser singleton
The WillRegistrationResultSerialiser singleton
A flag indicating a zlib compressed message
The build version of this client library
Wrap the parse function to cache results
Access to PropertyKeys
Access to the datatypes namespace
Global CBOR encoder
The ErrorReason enum
Valid TopicSpecification keys
The known transports. Will be looked up by name.
Access to the locks namespace
Invalid characters for a topic path to contain
The client will wait a maximum of two system ping periods for a ping from the server before declaring the connection idle and closing it.
Access to the selectors namespace
Disables logging below the given level.
Export is forwarded from loglevel.setLevel
.
The SharedWorker message routers indexed by the URL of the worker JS file
Access to the topicUpdate namespace
Access to the topics namespace
An unconstrained topic constraint that is sent to the server when no other constraint has been specified.
The UpdateConstraintFactory singleton instance
The version of this client library in the form major.minor.patch
Create range query parameters with a modified edit range
the original range query parameters
a modifier that is used to modify the RangeQueryParameters.editRange
new range query parameters
Create range query parameters with a modified view range
the original range query parameters
a modifier that is used to modify the RangeQueryParameters.viewRange
new range query parameters
Add a field to the array of fields
the buffer to parse
a reference to the records that will be constructed.
the start position in the buffer of the last field
the end position in the buffer of the last field
true
if the fields have been added to the records.
Cheap approximation to a square root.
the argument of the square-root function
a power of two that approximates the square root of a value
A converter function that converts bytes data to an event
a converter function that converts bytes data to an underlying value
the bytes containing the event in binary form
the event that was extracted from the bytes
Convert a buffer or array of bytes containing Record V2 data into a string
the bytes to convert
the starting position in the buffer
the number of bytes to convert
a string representation of the bytes
Call a function with arguments passed in as an array
Optimisation of Function.apply
for small number of arguments
Function.apply
is more than 20 times slower than direct function calls
see https://jsperf.com/function-versus-function-call-versus-function-apply
the function to call
the arguments in n array
the return value of the function call
Indicates whether a specified topic type can be read as a specified data type.
the topic type
the data type
true if the topic type can be read as the data type
Provide a canonical representation of a given path, stripping leading and trailing path separators
the path
the canonicalised path
The CBOR cost of an unsigned integer in bytes. It's cheaper to calculate than flush the encoder and check the number of written bytes.
the integer to check
byte cost
Check if min
and max
values specify a valid multiplicity
the name of the Field or Record to check
the minimum number of times the field should occur within the record
the maximum number of times the field should occur within the record
Check the satisfiability of applying a number of constraints.
the constraints that are ANDed together
Check if scale
values specify a valid multiplicity
the name of the Field
the scale of the field (number of decimal places). This must be positive.
Get the conversation id from the message headers
the message headers
the conversation ID
Create a new response code
the respnse code id
the message
a new response code
Converts a set of values to a canonicalised property string representation, escaping as required.
Uses comma separators and single quotes.
a set of strings
a string with each of the members escaped, quoted and concatenated
Compare two Events by their sequence numbers
Sorts first by originalEvent.sequence
. Events with equal
originalEvent.sequence
are sorted according to their sequence
field.
+1
if the first event has a larger sequence number than the
second event, -1
otherwise
Check if a match should be conflated with an insert
the starting position of the match
the number of bytes in the match
the number of bytes to be instered
true if it is worth conflating a match with an adjacent insert
Connect to a specified Diffusion server. This will return a Result that will complete successfully if a session can be connected, or fail if an error was encountered.
If the result is successful, the fulfilled handler will be called with a Session instance. This session will be in a connected state and may be used for subsequent API calls.
If the result fails, the rejected handler will be called with an error reason.
If sessionName
and workerJs
is supplied, then the call will create a
shared session inside a shared WebWorker. If a shared session with that name
already exists, this function will return an instance of the existing
session. Shared sessions can only be created when running in a browser
environment that supports the SharedWorker. For more information regarding
shared sessions, see connectShared.
Example:
diffusion.connect('example.server.com').then(function(session) {
// Connected with a session
console.log('Connected!', session);
}, function(error) {
// Connection failed
console.log('Failed to connect', error);
});
the options to construct the session with. If a string is
supplied, it will be interpreted as the host
option.
the name of the shared session
the location of the diffusion worker script
a Result for this operation
Connect to a specified Diffusion server using a shared WebWorker session. This will return a Result that will complete successfully if a session can be connected, or fail if an error was encountered. Shared sessions can only be created when running in a browser environment that supports the SharedWorker.
Shared sessions are identified by a name. If a shared session with that name already exists, this function will return an instance of the existing session. Otherwise the call will fail. Sessions can only be shared across scripts originating from a single domain. Otherwise the browser will create independent shared workers resulting in one shared session for each domain.
The shared session will stay alive as long as there is an open browser tab that initiated a connection through the shared session. When the last tab is closed the shared worker holding the shared session will be terminated. The shared session is also expected to be terminated when the only tab holding a reference to the session is reloaded or experiences a page navigation. The exact behavior may be browser dependent.
The workerJs
argument must be set to the URL of the diffusion-worker.js
supplied with the JavaScript distribution. The same-origin policy of
the shared worker requires the calling script and the diffusion-worker.js
to reside on the same domain.
If the result is successful, the fulfilled handler will be called with a Session instance. This session will be in a connected state and may be used for subsequent API calls.
If the result fails, the rejected handler will be called with an error reason.
Example:
diffusion.connectShared('some-session', 'diffusion-worker.js')
.then(function(session) {
// Connected with a session
console.log('Connected!', session);
}, function(error) {
// Connection failed
console.log('Failed to connect', error);
});
the name of the shared session
the location of the diffusion worker script
a Result for this operation
Get a connection action from a string
the string
a connection action obtained from the string
Factory for connection activity monitors.
the connection to be monitored
the new connection response
Connection response parser. Wraps the connection response deserialiser and takes callbacks for successful and failed parsing of the buffer.
on success callback
on failure callback
the buffer to parse
the parsed response or null if parsing failed
Construct a valid websocket URI from the given options.
the connection request.
the connection options.
the connection URI
Limit a diagonal by the length of an input.
If d is greater than the length, return the diagonal to use instead. This is used to constrain the forward vector entries to an (n+1) * (m+1) rectangle, and the reverse vector entries to an (m+1) * (n+1) rectangle.
Factory for creating a new Session activity monitor.
a new Session activity monitor
Create a new internal session
the options passed to the session
a new internal session
Create a new internal session factory that connects to a shared session in a webworker
a new internal session
the options passed to the session
Create the selected transport if enabled.
the subtransports that can be made
the options used to connect
the name of the subtransport to use
an available transport if enabled
Basic curry-right; provides partial application with arguments on the right
the function to call
the arguments passed to the function as the trailing arguments
the curried function
Returns a model string representation of the field's data type for the decimal type.
the field providing the type information
the zero value formatted according to the data type and scale
Unpack V5 credentials from a string.
the string
the v5 credentials
Thin wrapper around zlib.inflateSync
the compressed input
the decompressed output
A validator that doesn't validate
Create a RecordV2DeltaImpl that contains only new records
the buffer of the new record
the offset in the buffer of the new record
the number of bytes in the new record
a new RecordV2DeltaImpl
Create a new RecordV2DeltaImpl for an empty value
a new RecordV2DeltaImpl
Return a delta for when the old value is a single empty record. This assumes that the new record is neither empty nor a single empty record.
the buffer of the new record
the offset in the buffer of the new record
the number of bytes in the new record
a new RecordV2DeltaImpl
Create a new RecordV2DeltaImpl for a single record with no fields
a new RecordV2DeltaImpl
Deserialise connection responses according to the V5 protocol.
the Buffer to deserialise
Calculate the differences between two fields
the buffer of the old record
the offset in the buffer of the old record
the number of bytes in the old record
the buffer of the new record
the offset in the buffer of the new record
the number of bytes in the new record
the result recording the difference between the buffers
Calculate the differences between two record entries
the index of the record
the buffer of the old record
the offset in the buffer of the old record
the number of bytes in the old record
the buffer of the new record
the offset in the buffer of the new record
the number of bytes in the new record
the result recording the difference between the buffers
Calculate the differences between the fields of two record entries
the index of the record
the buffer of the old record
the offset in the buffer of the old record
the number of bytes in the old record
the buffer of the new record
the offset in the buffer of the new record
the number of bytes in the new record
the result recording the difference between the buffers
Calculate the differences between two records
the buffer of the old record
the offset in the buffer of the old record
the number of bytes in the old record
the buffer of the new record
the offset in the buffer of the new record
the number of bytes in the new record
the difference between the buffers
Calculate the differences between two record entries when the new record contains a single empty field
the index of the record
the result recording the difference between the buffers
Calculate the differences between two record entries when the old record contains a single empty field
the index of the record
the result recording the difference between the buffers
Create a single buffer containing multiple messages
the messages to conflate
a single buffer containing all messages
Tunnel a V5 credentials object as an encoded string within v4 password.
Currently only supports an empty or string password.
This implementation encapsulates code from both V4CredentialsTunnel and CredentialsSerialiser in the Java client.
the password to tunnel
an encoded password
Ensure that the array contains only octet numbers
the array to check
Count the number of records or fields in the raw Record V2 data
the bytes to check
the starting position in the buffer
the number of bytes to convert
the token indicating an empty set
the token separating two entities
the number of records in the data
Add reverse lookup to an enum-like object in order to imitate TypeScript
style enums. Each value must be an object that defines a numeric id
property.
Example:
const enumLike = {
FOO: { id: 0, msg: 'This is a Foo'},
BAR: { id: 1, msg: 'This is a Bar'}
}
enumerize(enumLike);
// enumLike = {
// FOO: { id: 0, msg: 'This is a Foo'},
// BAR: { id: 1, msg: 'This is a Bar'},
// 0: 'FOO',
// 1: 'BAR'
// }
the enum-like object
Escapes special characters in a string that is to be used within a topic property or a session filter.
This is a convenience method which inserts an escape character '' before any of the special characters ' " or .
the string to be escaped
the string value with escape characters inserted as appropriate
Escape special characters in the JSON pointer key string
the key string to escape
the escaped string
A converter function that converts an event to bytes data
a converter function that converts an underlying value to bytes data
the event to convert
the bytes containing the event
Extract the longest common prefix from a set of topic selectors
the topic selectors
the longest common prefix
Extract the largest possible topic path prefix from a string that may contain a regular expression.
The remainder (i.e expression minus prefix)
The maximum topic path that could be extracted
Count the number of fields in the raw Record V2 data
the bytes to check
the starting position in the buffer
the number of bytes to convert
the number of fields in the data
Check if two non-empty fields are equal
the buffer of the old record
the offset in the buffer of the old record
the buffer of the new record
the offset in the buffer of the new record
true
if the two fields are equal
Check if two fields are equal. The fields may be empty.
the buffer of the old record
the offset in the buffer of the old record
the number of bytes in the old record
the buffer of the new record
the offset in the buffer of the new record
the number of bytes in the new record
true
if the two fields are equal
Fill an array with a given value, within an optional range
the array to fill
the value to fill the array with
optional range start
optional range end
Filter a list of transport names, removing any unknown or disabled transports.
array of transport names
the available subtransports
the filtered array of transport names
Find a delimiter in the raw Record V2 data. Returns the position of the
within the range [startIndex
, endIndex
). If the delimiter is not found,
endIndex
will be returned.
the bytes to check
the first index to begin searching
the last index to stop searching
the delimiter to search for
the index of the delimiter
Find the next integer, equal or higher to the value, which is a power of two.
the value to search from
the next power of two
Create a new BinaryImpl object from a buffer or BinaryImpl. If a BinaryImpl is passed as argument it is simply returned.
the object to create a JSON from
the record created
Creates a Buffer from any data type
If the content
is a BufferSlice then getBytes
returns the sliced
data. If the content
is a Buffer
, it is returned unchanged. Otherwise a
new Buffer is created from the content's toString()
representation.
the content
a Buffer containing the content
Extract a component group from a single expression
the selector expression
an object containing parsed properties
Construct a header string
the message from which to construct the header string
the string to be serialised in the header
Read a 32 bit integer from the buffer
the buffer to write into
a flag indicating whether to read the high or the low bits of the buffer
the integer that was read from the buffer
A factory for conversation sets with conversation IDs obtained from the shared session.
the shared session connector
Get a shared worker message router
the JS file name that contains the worker code, should
contain the path to the diffusion-worker.js
file.
An interface to the shared worker that allows communicating with named shared sessions
Determine the Topic Selector type of a given expression.
the selector expression
the topic selector type, or null
The identity function
a value
the input value val
Replacer function for JSON.stringify that replaces Int64Impl objects with their string representation
the object key (this argument is ignored)
the value to replace
if value
is an Int64Impl then the string
representation is returned. Otherwise value
is returned
unchanged.
Converts an integer conforming to IEEE 754 Single bit format to a floating point value. This is similar to Java's Float#intBitsToFloat.
See https://en.wikipedia.org/wiki/Single-precision_floating-point_format for detail on the bit layout.
Code taken from http://stackoverflow.com/a/16001019 - most succinct implementation I could find that avoided unnecessary loops or reads.
integer containing IEEE-754 value bytes
the resulting float
Allow any CBOR types
will always return true
Check if a response code indicates that the client should attempt to cascade
the response code
true
if the client should attempt to cascade on receiving a response
Check if the constraint constrains the topic value
the constraint to check
true
if the constraint type is one of
'BINARY_VALUE', 'NO_VALUE', 'NO_TOPIC', 'PARTIAL_JSON'
Allow only floating point CBOR types
the CBOR type
true
if the type is a floating point number
Allow only int CBOR types
the CBOR type
true
if the type is an integer
Cheap type guard for a specific type
Check is a variable is an object and assume that it is of a given type
the type that is assumed if o
is an object
the object to check
true
if o
is an object
Check if a BufferSlice contains the same bytes as the original Bytes
the original bytes
the buffer to compare to
the offset of the first byte to compare in the buffer
the number of bytes to compare
true
if the slice of the other
buffer is equal to the
bytes contained in original
check if the string is a quote mark
the string to check
true
if the string is either a single ' or double " quote
Checks if the data contains a single empty record
the bytes to check
the starting position in the buffer
the number of bytes to convert
true
if the data contains a single empty record
Allow only string CBOR types
the CBOR type
true
if the type is a string
Utility function to check for ending tokens of arrays, maps, or strings
the token to check
true
if the token ends a structure
Utility function to check for starting tokens of arrays, maps, or strings
the token to check
true
if the token starts a structure
Check if the response code indicates a success
the response code
true
if the response code indicates a success
Determine if a component group can be treated as a topic path.
the component group
if the components represent a topic path selector
Check if the argument is a typed array
the object to check
true
if the object is an instance of a typed array
Check if the zlib library is installed
true
if the zlib module is provided
Calculate the number of leading zeros in the binary representation of a number using the minimal amount of bit-shifting
the number to analyse
the number of leading binary zeros
Set the level of logging used by Diffusion. This will default to silent. Log levels are strings that represent different degrees of information to be logged. Available options are:
the logging level
a logging function that writes verbose output
Apply a bitmask to a number to calculate the modulo of a power of two. This is used to determine the position in a circular buffer
the number to mask
the capacity, must be a power of two
the reduced value
Wrap a function with an automatic memoization layer.
the internal cache to use.
the matcher function to return a cache key from an array of arguments
the memoized function
A matcher function to memoize arguments for the parseSelector function
the arguments
a JSON string of the arguments
Check is a value is not null
or undefined
the value to check
true
if the value is truthy
Validate characters in a normal parsing mode
the character to check
true
if the character is a normal path character
Returns a validated value in the format indicated by the field
the field providing the type information
the value to convert
a string representation of the value
Create an array of a given size, optionally pre-filled with a specified initial value.
the size of the array to create
if specified, the initial will be assigned to each element
Parse a buffer of Record V2 data and split it into records and fields
the buffer to parse
the starting position in the buffer
the number of bytes to convert
an array of records, each containing an array of fields
Helper function to create a client topic message
the message type to create
the message encoding
the buffer that is passed into the Message.data property
a callback that is called when the message has been parsed or an error has occurred.
Parse a selector expression into a specific TopicSelector implementation.
the selector's string expression
a new topic selector
Helper function to create a service message
the message type to create
the buffer that is passed into the Message.data property of the message
the newly constructed message
Returns a session ID if parseable, else false.
the string containing the session ID
the session ID or false
Convert an array of permissions to a single formatted string
an array of permissions
a string containing the concatenated permissions, surrounded by brackets
Process the end of the record data
the buffer to parse
a reference to the records that will be constructed. A new record will be added to this array.
the start position in the buffer of the last field
the end position in the buffer of the last field
Process a record delimiter
the buffer to parse
a reference to the records that will be constructed. A new record will be added to this array.
the start position in the buffer of the last field
the end position in the buffer of the last field
Store a 32 bit integer in the buffer
the 32 bit integer to store
the buffer to write into
a flag indicating whether to store the integer in the high or the low bits of the buffer
Store a negative number in the buffer
the number to store
the buffer to write into
Store a positive number in the buffer
the number to store
the buffer to write into
Store an integer represented by a string in the buffer
the string containing the number to store
the radix of the number representation
the buffer to write into
Quote any necessary characters within a string
the string to escape
a quoted and escaped string
Validated characters within a quoted block (\Q \E)
true
Read content from an input stream
The enum values must all lie between 0 and 63 inclusive.
The enum values must all lie between 0 and 63 inclusive.
the stream from which to read the enum value
a Buffer containing the content
Read the author encoding an store it in the codeToAuthor
map
the input stream
a mapping between author codes and authors
Read a boolean value
the input stream to read from
the boolean that was read
Read a single byte from the input
the input stream to read from
the next byte in the input stream
Read bytes as a Buffer
the input stream to read from
the bytes that were read
Read a collection of objects, using a specific reader function
the type of data in the collection
the input stream to read from
the reader function
an array of read values
Read a dictionary of strings and values of a given type
the type of data stored in the dictionary
the input stream to read from
value reader function
a dictionary of values
Read an edit event
the input stream
the offsets of the range in the result
a mapping between author codes and authors
the edit event that was read
Read a FetchTopicResult from the stream
the input stream
the FetchTopicResult that was read
Read an encoded Int32
The input stream to read from
the Int32 that was read
Read an encoded Int64
This will return the value as a Long instance.
the input stream from which to read
the decoded Int64, represented as Long
Read a map of keys/values
the type of the map keys
the key reader function
the Value reader function
the read map
Read event metadata
the offsets of the range in the result
a mapping between author codes and authors
the metadata that was read
Read time series offsets
the input stream
the offsets of the range in the result that were read
Read a map of keys/values as an object
the type of data stored in the object
the type of the object keys
the key reader function
the Value reader function
the read map
Read an original event
the input stream
the offsets of the range in the result
a mapping between author codes and authors
the original event that was read
Read a Point from the stream
the input stream
the Point that was read
Read a property map from the stream
the input stream
the property map that was read
Read a Range from the stream
the input stream
the Range that was read
Read a remote server from the stream
the input stream
the RemoteServer that was read
Read a remote server status from the stream
the input stream
the RemoteServerStatus that was read
Read a SessionToken
the input stream to read from
a new session token
Read a UTF-8 encoded String
the input stream to read from
the string that was read
Read a topic view from the stream
the input stream
the TopicView that was read
Create a reconnection request with provided options
the session token
the available client sequence number
the last server sequence number
a new reconnection request
Count the number of records in the raw Record V2 data
the bytes to check
the starting position in the buffer
the number of bytes to convert
the number of records in the data
Checks if the data contains a single empty field
the bytes to check
the starting position in the buffer
the number of bytes to convert
true
if the data contains a single empty field
Create a regex matcher function for a given regex expression, with an optional context for RegEx construction error messages.
The returned function will evaluate the generated regex across the entire region of the given input. This is equivalent to Matcher.matches in Java.
the regular expression
the optional context message
the tester function
Register a handler with the conversation set.
the internal session
the registration parameters to send to the server
the registration adapter
the registration service that is used to register with the server
the deregistration service that is used to deregister with the server
Register a handler for messages
the internal session
the registration parameters to send to the server
the registration adapter
Register a handler for the messaging service
the internal session
the registration parameters to send to the server
the registration adapter
Register a handler for topic control notifications
the internal session
the registration parameters to send to the server
the registration adapter
Create a registration callback function
the conversation set
the conversation ID
a new registration callback function
Remove an element from an array.
the type of the elements stored in the array
the object to remove
true
if the element was present in the array
Create a delta that contains only the new value
the buffer containing the value
the resulting delta
Require that a number is defined and is not negative
the value to check
description to include in thrown error
the number
Throw an error if the checked value is null/undefined.
the value to check
description to include in thrown error
the checked value
Get the absolute index of a record in the schema
the record to inspect
the array of records that contains the record
an index offset
the absolute index of the record in the schema
Create a new response handler
the internal session
the registration adapter
the deregistration callback
a new response handler
Type guard for responses from a ServiceSender.
the response error, if present
the response data
returns true
if the error is falsy. In this case, the ServiceSender should have called
the response callback with a valid response.
Utility method which converts a set of authorisation roles to the string format required by the $Roles session property.
Uses comma separators and single quotes.
a set of strings
a string representing the supplied roles, formatted as required by the $Roles session property
Reduce the accuracy of a timestamp
the time stamp to round
the reduced accuracy time stamp
Serialise an double value into a CBOR encoder
the value to serialise
the encoder
Convert an array of strings to a single formatted string
an array of strings
a string containing each string in quotes, concatenated and surrounded by brackets
Split a path into parts.
This differs from String.split in two ways:
Example:
split("foo/bar/", "/"); // Returns ["foo", "bar"];
Example:
split("foo///", "//"); // Returns ["foo/"];
the path
the parts
Converts a formatted multi value property to an array.
Unescapes any escaped characters in the string.
the string with quoted substrings separated by whitespace or commas
array of strings
Utility method which converts a string of the format required by the $Roles session property into a mutable set of strings.
Unescapes any escaped characters in the string.
the string with quoted substrings separated by whitespace or commas
set of roles
Converts a formatted multi value property to an immutable set.
Unescapes any escaped characters in the string.
the string with quoted substrings separated by whitespace or commas
set of strings
Write record data to a buffer
the records to write
the buffer containing the serialised data
Convert the record schema to a raw data object
a data object that can be serialised with using JSON
Returns an update constraint factory.
update constraint factory
Validate Record V2 model data of a single field against the schema field
the field schema to validate against
the record index
the field index
the field model data
Validate Record V2 model data against a schema
the schema to validate against
the record data
Validate Record V2 model data of a single record against the schema record
the record schema to validate against
the record index
the individual record data
Optionally environment specific websockets.
Handler for the shared worker's onconnect event
the incoming message event
Write content to an output stream
If the content
is a BufferSlice then only the sliced data is
written. Otherwise a new Buffer is written that is created from the content's
toString()
representation.
the buffer output stream
the content
Write a boolean value
the output stream to write to
the boolean value to write
Write a single signed byte
the output stream to write to
the byte value to write. Must be between 0 and 255
Write multiple bytes
the output stream to write to
the bytes to be written
Write a collection of objects, using a specific writer function
the type of data in the collection
the output stream to write to
array of values
writer function
Write a dictionary of strings and values
the type of data stored in the dictionary
the output stream to write to
the dictionary of values
value writer function
Write an encoded Int32
the output stream to write to
the number to write as an int32
Write an encoded Int64
Writes a number as an Int64 to the given Output stream.
the output stream to write to
the number to write
Write a Limit to the stream
the output stream
Write an object of keys/values
the type of the map keys
the output stream to write to
the Key writer function
the Value writer function
Write an object of keys/values
the type of data stored in the object
the type of the object keys
the output stream to write to
the map of values
the Key writer function
the Value writer function
Write a Point to the stream
the output stream
Write a FetchRange to the stream
the output stream
Write a string using UTF-8 encoding
the output stream to write to
the string to write
Serialise a message into a buffer
the message to write
the buffer to write into
A converter function that converts an event to buffer data
a converter function that converts an underlying value to bytes data
the event to convert
the buffer containing the event
Optionally provide environment specific XHR.
An enum-like object containing all possible connection actions
Value returned by Session.getPrincipal if no principal name is associated with the session.
Dictionary containing standard session property keys
Example:
// Get the ALL_FIXED_PROPERTIES key
var props = diffusion.clients.PropertyKeys.ALL_FIXED_PROPERTIES;
Example:
// Get all user and fixed properties
var props = diffusion.clients.PropertyKeys.ALL_FIXED_PROPERTIES
.concat(diffusion.clients.PropertyKeys.ALL_USER_PROPERTIES);
Enum representing the reason that the session has been closed.
Example:
diffusion.connect({...}).then(function(session) {...}, function(err) {
switch(err) {
case diffusion.clients.CloseReason.CLOSED_BY_CLIENT:
// Do something
case diffusion.clients.CloseReason.ACCESS_DENIED:
// Do something else
...
}
});
The connection attempt failed due to a security restraint or due to invalid credentials.
The client requested close. Not recoverable.
The session has been closed by the server, or another session using the ClientControl feature.
The client could not establish a connection to the server.
An error was thrown while the client was attempting to connect to the server.
The connection attempt timed out, waiting for a response from the server.
The reconnection timeout can be controlled by the reconnect options.
There was an error parsing the handshake response.
The client received a handshake response from the server but the response was malformed and could not be deserialised.
The connection handshake was rejected by the server.
The server responded with an unknown error code when the client attempted to connect.
The client detected that the connection was idle.
The client has not received a ping message from the server for an extended period of time.
The connection request was rejected because the license limit was reached.
Loss of messages from the client has been detected. For example, whilst waiting for the arrival of missing messages in a sequence of messages a timeout has occurred.
HTTP based transports use multiple TCP connections. This can cause the messages to be received out of order. To reorder the messages those sent to the server may contain a sequence number indicating the correct order.
If a message is received out of order there is a short time for the earlier messages to be received. If the messages are not received in this time the client is closed.
Missing, invalid or duplicate sequence numbers will also close the client for this reason.
This cannot be recovered from as the client and the server are in inconsistent states.
The handshake response contained an incompatible protocol version.
The server does not support the client's protocol version.
Whilst disconnected, the client explicitly aborted a reconnect attempt.
There was an unexpected error with the network connection.
The underlying transport (Websocket, XHR) received an error that could not be handled.
Null object implementation of Session activity monitor.
A service callback that does nothing
Protocol constants
A code indicating the clients capabilities
The client's protocol version
A byte inticating the diffusion protocol
The protocol type
Enum-like object for timeseries query types
A query type for all edits
A query type for the latest edits
A values query type
Enum-like object for timeseries stream structures
An edit event stream
A value event stream
The reason that a topic could not be added.
Example:
session.topics.add('foo').then(function() { ... }, function(err) {
switch (err) {
case diffusion.topics.TopicAddFailReason.EXISTS:
...
case diffusion.topics.TopicAddFailReason.INVALID_PATH:
...
}
});
When trying to create the topic the cluster was migrating the partition that owns the topic. The correct owner could not be identified and the request failed. This is a transient failure for the duration of the partition migration.
Adding the topic failed because of a license limit.
The topic already exists with the same details.
Adding the topic failed because a topic is already bound to the specified path but the caller does not have the rights to manage it.
This can be because the topic is being managed by a component with exclusive control over the topic, such as fan-out and thus the caller will not be able to update or remove the topic.
If the caller has suitable permissions then it could still subscribe to the topic, but the topic's specification may be different from that requested.
The topic already exists, with different details.
Adding the topic failed because an incompatible topic owned is already bound to the parent path.
The topic could not be initialised, supplied value may be of the wrong format. Deprecation notice
This value is associated only with removed methods that allow the specification of an initial value when creating a topic. It will be removed in a future release.
The topic details are invalid.
The supplied topic path is invalid.
The topic path is invalid.
Invalid permissions to add a topic at the specified path.
A referenced topic could not be found.
An unexpected error occured while creating the topic.
A user supplied class could not be found or instantiated. Deprecation notice
This value is associated only with removed methods that create topics. It will be removed in a future release.
Enum containing possible Topic Types.
Example:
// Get a topic type for adding topics
var topicType = diffusion.topics.TopicType.JSON;
session.topics.add("foo", topicType);
Binary Topic.
This is a stateful topic that handles data in Binary format.
Topic that stores and publishes IEEE 754 double-precision floating point numbers (i.e native JavaScript Numbers). Based on the double data type.
Supports null Double values.
The topic does not support delta-streams - only complete values are transmitted.
Topic that stores and publishes 64-bit integer values. Based on the int64 data type. Values are of the type Int64.
Supports null int64 values.
Does not support delta-streams - only complete values are transmitted.
JSON (JavaScript Object Notation) Topic.
This is a stateful topic that handles data in JSON representation.
Topic that stores and publishes data in the form of records and fields. Based on the RecordV2 data type.
Supports delta-streams.
Routing Topic.
A functional topic that can point to different target topics for different clients.
From the point of view of a client subscribing to such a topic this would be seen as a normal stateful topic but it has no state of its own and cannot be published to.
Such a topic may specify a user written Java class which will be invoked to define the mapping of the topic to another data topic when a client subscribes. Alternatively the mapping can be delegated to a control client using the SubscriptionControl feature.
Topic that stores and publishes String values. Based on the string data type.
Supports null String values.
Supports delta-streams.
Time Series Topic.
A time series is a sequence of events. Each event contains a value and has server-assigned metadata comprised of a sequence number, timestamp, and author.
A time series topic allows sessions to access a time series that is
maintained by the server. A time series topic has an associated
event data type, such as Binary
, String
,
or JSON
, that determines the type of value associated with each
event.
The TIME_SERIES_SUBSCRIPTION_RANGE property configures the range of historic events retained by a time series topic. If the property is not specified, a time series topic will retain the ten most recent events.
The TIME_SERIES_SUBSCRIPTION_RANGE property configures a time series topic to send a range of historic events from the end of the time series to new subscribers. This is a convenient way to synchronize new subscribers without requiring the use of a range query.
By default, new subscribers will be sent the latest event if delta streams are enabled and no events if delta streams are disabled. See the description of Subscription range in the Session.timeseries time series feature} documentation.
The TIME_SERIES_EVENT_VALUE_TYPE property must be provided when creating a time series topic.
A topic type that is unsupported by the session.
Enum like object of point types
Enum containing reasons that an unsubscription occurred.
Example:
// Use UnsubscribeReason to validate unsubscription notifications
session.addStream('>foo', diffusion.datatypes.string())
.on('unsubscribe', function(topic, specification, reason) {
switch (reason) {
case diffusion.topics.UnsubscribeReason.REMOVED :
// Do something if the topic was removed
default :
// Do something else if the client was explicitly unsubscribed
}
});
Action to be taken by the system authentication handler for connection attempts that do not provide a principal name and credentials.