@@ -149,17 +149,24 @@ Register a new middleware.
149
149
* ` 'afterSubmit' ` : An operation was successfully submitted to
150
150
the database.
151
151
* ` 'receive' ` : Received a message from a client
152
- * ` fn ` _ (Function(request, callback))_
152
+ * ` 'reply' ` : About to send a non-error reply to a client message
153
+ * ` fn ` _ (Function(context, callback))_
153
154
Call this function at the time specified by ` action ` .
154
- ` request ` contains a subset of the following properties, as relevant for the action:
155
- * ` action ` : The action this middleware is handing
156
- * ` agent ` : An object corresponding to the server agent handing this client
157
- * ` req ` : The HTTP request being handled
158
- * ` collection ` : The collection name being handled
159
- * ` id ` : The document id being handled
160
- * ` snapshots ` : The retrieved snapshots for the ` readSnapshots ` action
161
- * ` query ` : The query object being handled
162
- * ` op ` : The op being handled
155
+ * ` context ` will always have the following properties:
156
+ * ` action ` : The action this middleware is hanlding
157
+ * ` agent ` : A reference to the server agent handling this client
158
+ * ` backend ` : A reference to this ShareDB backend instance
159
+ * ` context ` can also have additional properties, as relevant for the action:
160
+ * ` collection ` : The collection name being handled
161
+ * ` id ` : The document id being handled
162
+ * ` op ` : The op being handled
163
+ * ` req ` : HTTP request being handled, if provided to ` share.listen ` (for 'connect')
164
+ * ` stream ` : The duplex Stream provided to ` share.listen ` (for 'connect')
165
+ * ` query ` : The query object being handled (for 'query')
166
+ * ` snapshots ` : Array of retrieved snapshots (for 'readSnapshots')
167
+ * ` data ` : Received client message (for 'receive')
168
+ * ` request ` : Client message being replied to (for 'reply')
169
+ * ` reply ` : Reply to be sent to the client (for 'reply')
163
170
164
171
### Projections
165
172
0 commit comments