This repository was archived by the owner on Apr 15, 2025. It is now read-only.
Releases: CanopyTax/rxws
Releases · CanopyTax/rxws
v5.3.8
v5.3.7
Remove automatic timeout error handling. Instead this should be implemented with middleware.
#11
This should now be implemented with middleware:
let requestMap = {};
rxws.requestUse().subscribe(({req, send, next, reply}) => {
const correlationId = req.header.correlationId;
if (requestMap[correlationId]) clearTimeout(requestMap[correlationId]);
requestMap[correlationId] = setTimeout(() => {
console.error(`No response after 10 seconds for resource ${req.header.resource}`);
}, 10000);
next();
});
rexws.use().subscribe(({res, reply, retry, next}) => {
const correlationId = res.header.correlationId;
clearTimeout(requestMap[correlationId]);
delete requestMap[correlationId];
next();
});v5.3.5
v5.3.4
Bugfix
v5.3.2
v4.1.0
Update middleware API
Middleware API error subscriptions now get the request object:
rxws.use()
.subscribe(({req, res, reply, retry, next}) => {
res.requestTime = Date.now();
next();
});
rxws.use()
.subscribe(({req, res, reply, retry, next}) => {
next();
}, ({req, err}) => {
// Do something with the error and the request.
});v3.5.0
Modify the startMockingRequests functionality to work with middleware.
import rxws from 'rxws';
// This will make RXWS not validate having a backend with a url to connect the websocket to
rxws.startMockingRequests();
rxws.requestUse()
.subscribe(({req, send, reply, next}) => {
// Calling reply will immediately resolve the rx subscription without hitting the server
reply({
header: { ...req.header, statusCode: 200 },
body: { data: 'whatever you want' }
});
});
// Re-enable validations
rxws.stopMockingRequests();
// Reset all internal `rxws` state (including middleware)
rxws.reset();