Agent
- TOC
An Agent
is the representation of a client’s Connection
state on the server.
The Agent
instance will be made available in all middleware contexts, where agent.custom
can be particularly useful for storing custom context.
If the Connection
was created through backend.connect()
(i.e. the client is running on the server), then the Agent
associated with a Connection
can be accessed through connection.agent
.
Properties
custom
– Object
An object that consumers can use to pass information around through the middleware.
The agent.custom
is passed onto the options
field in database adapter calls as options.agentCustom
. This allows further customisation at the database level e.g. in sharedb-mongo
middleware.
backend
– Backend
The
Backend
instance that created thisAgent