why deepstreamHub? compare us getting started faq
use cases
products
developers
company
blog contact

Constants

Constants are used throughout deepstream. They can be accessed via the module.

// client
const {
  CONSTANTS
} = require('deepstream.io-client-js');

// server
const {
  constants
} = require('deepstream.io');

General

name value server client
MESSAGE_SEPERATOR ASCII 30
MESSAGE_PART_SEPERATOR ASCII 31
SOURCE_MESSAGE_CONNECTOR SOURCE_MESSAGE_CONNECTOR

Log Level

name value server client
LOG_LEVEL.DEBUG 0
LOG_LEVEL.INFO 1
LOG_LEVEL.WARN 2
LOG_LEVEL.ERROR 3
LOG_LEVEL.OFF 100

Server State

name value server client
STATES.STARTING starting
STATES.INITIALIZED initialized
STATES.IS_RUNNING is-running
STATES.CLOSING closing
STATES.CLOSED closed

Connection State

name value server client
CONNECTION_STATE.CLOSED CLOSED
CONNECTION_STATE.AWAITING_CONNECTION AWAITING_CONNECTION
CONNECTION_STATE.CHALLENGING CHALLENGING
CONNECTION_STATE.AWAITING_AUTHENTICATION AWAITING_AUTHENTICATION
CONNECTION_STATE.AUTHENTICATING AUTHENTICATING
CONNECTION_STATE.OPEN OPEN
CONNECTION_STATE.ERROR ERROR
CONNECTION_STATE.RECONNECTING RECONNECTING

Event

name value server client
EVENT.TRIGGER_EVENT TRIGGER_EVENT
EVENT.INCOMING_CONNECTION INCOMING_CONNECTION
EVENT.INFO INFO
EVENT.SUBSCRIBE SUBSCRIBE
EVENT.UNSUBSCRIBE UNSUBSCRIBE
EVENT.RECORD_DELETION RECORD_DELETION
EVENT.INVALID_AUTH_MSG INVALID_AUTH_MSG
EVENT.INVALID_AUTH_DATA INVALID_AUTH_DATA
EVENT.AUTH_ATTEMPT AUTH_ATTEMPT
EVENT.AUTH_ERROR AUTH_ERROR
EVENT.TOO_MANY_AUTH_ATTEMPTS TOO_MANY_AUTH_ATTEMPTS
EVENT.AUTH_SUCCESSFUL AUTH_SUCCESSFUL
EVENT.NOT_AUTHENTICATED NOT_AUTHENTICATED
EVENT.CONNECTION_ERROR CONNECTION_ERROR
EVENT.MESSAGE_PERMISSION_ERROR MESSAGE_PERMISSION_ERROR
EVENT.MESSAGE_PARSE_ERROR MESSAGE_PARSE_ERROR
EVENT.MAXIMUM_MESSAGE_SIZE_EXCEEDED MAXIMUM_MESSAGE_SIZE_EXCEEDED
EVENT.MESSAGE_DENIED MESSAGE_DENIED
EVENT.INVALID_MESSAGE_DATA INVALID_MESSAGE_DATA
EVENT.UNKNOWN_TOPIC UNKNOWN_TOPIC
EVENT.UNKNOWN_ACTION UNKNOWN_ACTION
EVENT.MULTIPLE_SUBSCRIPTIONS MULTIPLE_SUBSCRIPTIONS
EVENT.NOT_SUBSCRIBED NOT_SUBSCRIBED
EVENT.LISTENER_EXISTS LISTENER_EXISTS
EVENT.NOT_LISTENING NOT_LISTENING
EVENT.IS_CLOSED IS_CLOSED
EVENT.ACK_TIMEOUT ACK_TIMEOUT
EVENT.RESPONSE_TIMEOUT RESPONSE_TIMEOUT
EVENT.DELETE_TIMEOUT DELETE_TIMEOUT
EVENT.UNSOLICITED_MESSAGE UNSOLICITED_MESSAGE
EVENT.MULTIPLE_ACK MULTIPLE_ACK
EVENT.MULTIPLE_RESPONSE MULTIPLE_RESPONSE
EVENT.NO_RPC_PROVIDER NO_RPC_PROVIDER
EVENT.RECORD_LOAD_ERROR RECORD_LOAD_ERROR
EVENT.RECORD_CREATE_ERROR RECORD_CREATE_ERROR
EVENT.RECORD_UPDATE_ERROR RECORD_UPDATE_ERROR
EVENT.RECORD_DELETE_ERROR RECORD_DELETE_ERROR
EVENT.RECORD_SNAPSHOT_ERROR RECORD_SNAPSHOT_ERROR
EVENT.RECORD_NOT_FOUND RECORD_NOT_FOUND
EVENT.CACHE_RETRIEVAL_TIMEOUT CACHE_RETRIEVAL_TIMEOUT
EVENT.STORAGE_RETRIEVAL_TIMEOUT STORAGE_RETRIEVAL_TIMEOUT
EVENT.CLOSED_SOCKET_INTERACTION CLOSED_SOCKET_INTERACTION
EVENT.CLIENT_DISCONNECTED CLIENT_DISCONNECTED
EVENT.INVALID_MESSAGE INVALID_MESSAGE
EVENT.VERSION_EXISTS VERSION_EXISTS
EVENT.INVALID_VERSION INVALID_VERSION
EVENT.PLUGIN_ERROR PLUGIN_ERROR
EVENT.UNKNOWN_CALLEE UNKNOWN_CALLEE

Topic

name value server client
TOPIC.CONNECTION C
TOPIC.AUTH A
TOPIC.ERROR X
TOPIC.EVENT E
TOPIC.RECORD R
TOPIC.RPC P
TOPIC.PRIVATE PRIVATE/

Actions

name value server client
ACTIONS.PING PI
ACTIONS.PONG PO
ACTIONS.ACK A
ACTIONS.READ R
ACTIONS.REDIRECT RED
ACTIONS.CHALLENGE CH
ACTIONS.CHALLENGE_RESPONSE CHR
ACTIONS.CREATE C
ACTIONS.UPDATE U
ACTIONS.PATCH P
ACTIONS.DELETE D
ACTIONS.SUBSCRIBE S
ACTIONS.UNSUBSCRIBE US
ACTIONS.HAS H
ACTIONS.SNAPSHOT SN
ACTIONS.LISTEN_SNAPSHOT LSN
ACTIONS.LISTEN L
ACTIONS.UNLISTEN UL
ACTIONS.LISTEN_ACCEPT LA
ACTIONS.LISTEN_REJECT LR
ACTIONS.SUBSCRIPTION_HAS_PROVIDER SH
ACTIONS.SUBSCRIPTIONS_FOR_PATTERN_FOUND SF
ACTIONS.SUBSCRIPTION_FOR_PATTERN_FOUND SP
ACTIONS.SUBSCRIPTION_FOR_PATTERN_REMOVED SR
ACTIONS.PROVIDER_UPDATE PU
ACTIONS.QUERY Q
ACTIONS.CREATEORREAD CR
ACTIONS.EVENT EVT
ACTIONS.ERROR E
ACTIONS.REQUEST REQ
ACTIONS.RESPONSE RES
ACTIONS.REJECTION REJ

Data Types

name value server client
TYPES.STRING S
TYPES.OBJECT O
TYPES.NUMBER N
TYPES.NULL L
TYPES.TRUE T
TYPES.FALSE F
TYPES.UNDEFINED U

Errors

Errors are used throughout deepstream. They can be accessed via the module.

const deepstream = require('deepstream.io-client-js')
deepstream.CONSTANTS.EVENTS
name description server client
CONNECTION_ERROR The websocket connection has encountered an error.
UNSOLICITED_MESSAGE A message was received that the client didn't expect, e.g. an update for a record that the client isn't subscribed to. This doesn't necessarily have to be an error, but can also be the result of messages crossing on the wire, e.g. when an outgoing record discard and an incoming message overlap.
MESSAGE_PARSE_ERROR The client has received a syntactically incorrect message.
IS_CLOSED Emitted when the client tries to authenticate against an already closed connection.
VERSION_EXISTS The client has tried to update a record to a version that the server already has. This might happen if multiple clients try to update the same record at the same time. This error will also be emitted by the affected Record. To mitigate this error, configure a merge strategy
NOT_AUTHENTICATED Emitted if an operation is attempted before the client is authenticated (before login() has been called and a response was received).
ACK_TIMEOUT The acknowledgement response for a record subscription, event subscription or rpc call hasn't been received in time. This error is also emitted by the object that encountered it, e.g. the Record or Rpc.
LISTENER_EXISTS Emitted when client.record.listen( pattern, callback ) is called more than once for the same pattern.
NOT_LISTENING Emitted when client.record.unlisten( pattern ) is called for a pattern that no listener exists for.
TOO_MANY_AUTH_ATTEMPTS Emitted when the client has made more invalid authentication attempts than the server accepts. This can be configured as maxAuthAttempts on the server.