Type alias MiddlewareFactory<FR, FW, RR, RW>
MiddlewareFactory<FR, FW, RR, RW>: ((ctx, cancel, meta) => {
forward: ReadableWritablePair<FR, FW>;
reverse: ReadableWritablePair<RR, RW>;
})
Type declaration
-
- (ctx, cancel, meta): {
forward: ReadableWritablePair<FR, FW>;
reverse: ReadableWritablePair<RR, RW>;
}
-
Parameters
-
ctx: ContextTimed
-
cancel: ((reason?) => void)
-
- (reason?): void
-
Returns void
-
meta: Record<string, JSONValue> | undefined
Returns {
forward: ReadableWritablePair<FR, FW>;
reverse: ReadableWritablePair<RR, RW>;
}
-
forward: ReadableWritablePair<FR, FW>
-
reverse: ReadableWritablePair<RR, RW>
Middleware factory creates middlewares. Each middleware is a pair of forward and reverse. Each forward and reverse is a
ReadableWritablePair
. The forward pair is used transform input from client to server. The reverse pair is used to transform output from server to client. FR, FW is the readable and writable types of the forward pair. RR, RW is the readable and writable types of the reverse pair. FW -> FR is the direction of data flow from client to server. RW -> RR is the direction of data flow from server to client.