Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Releases: CanopyTax/rxws

v5.3.8

29 Sep 21:53

Choose a tag to compare

Fix bug in Edge and FF #12

v5.3.7

21 Jun 19:21

Choose a tag to compare

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

17 Jun 20:54

Choose a tag to compare

Make sure the new HTTPTransport error handling doesn't swallow middleware errors: 6a0a372

v5.3.4

17 Jun 17:14

Choose a tag to compare

Fix error handling: #10

Bugfix

16 Jun 16:33

Choose a tag to compare

Fix for #9

v5.3.2

13 Jun 23:44

Choose a tag to compare

Bugfix #8

v4.1.0

28 Mar 21:18

Choose a tag to compare

Changes

  1. Improve the exponential back-off.
  2. Allow the backend URL to be produced by an observable:
rxws.setBackend({
  backend: SockJSBackend,
  url: () => Observable.create((observer) => {
    observer.onNext('someUrl');
  })
});

Update middleware API

16 Mar 18:39

Choose a tag to compare

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

10 Feb 21:49

Choose a tag to compare

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();

v3.3.0

09 Feb 23:23

Choose a tag to compare

Add ability to mock requests.

import rxws from 'rxws';

rxws.startMockingRequests(testRequest);

rxws.get('users').then(() => {});

function testRequest(request) {
  expect(request).toBe(....);
}

rxws.stopMockingRequests();