Skip to content

Conversation

@hthetiot
Copy link
Contributor

@hthetiot hthetiot commented Dec 13, 2017

Todo

  • Init worker
  • Add config worker
  • Send XHR to worker
  • Sync XHR from client via channel
  • Implement tests
  • Try common buffer format transferable for response (DISABLED)
  • Implement transferable Array buffer
  • Fix responseType arraybuffer in worker via native (test fail/disabled)
  • Add test end to end array buffer
  • Detect http2-cache location for default worker
  • Use worker by default if available
  • Piping logging over into the channel.
  • Add test-server ws/http1/http2 gzip support
  • Merge develop

Usage:

XMLHttpRequest.proxy({
        'transport': 'ws://localhost:7081/path',
        'worker': true, // bool to enable, string 'path to worker' or Worker instance
       // OR
        'worker': 'packages/http2-cache/dist/http2-cache.js'
        'proxy': [
            'http://cache-endpoint/',
            'http://localhost:7080/path/proxy',
        ]
    });

Test result

screen shot 2017-12-15 at 2 20 07 pm

Reviewer note

Main commit is ece50af
Previous commit to this one are in #88

configuration init worker handler

https://github.com/kaazing/http2-cache.js/blob/features/workerSupport/lib/configuration.js#L53

addConfig handler

https://github.com/kaazing/http2-cache.js/blob/features/workerSupport/lib/configuration.js#L339

sendViaChannel handler

https://github.com/kaazing/http2-cache.js/blob/features/workerSupport/lib/xhr.js#L413
https://github.com/kaazing/http2-cache.js/blob/features/workerSupport/lib/configuration.js#L459

Browser Support

Tested: Chrome, Firefox, Opera, Safari, IE.

Tests results

Test:

With gzip

screen shot 2018-02-06 at 12 21 11 pm

npm run integration:worker

screen shot 2017-12-18 at 1 56 39 pm

screen shot 2017-12-18 at 1 57 13 pm

screen shot 2018-02-06 at 3 06 02 pm

screen shot 2017-12-18 at 1 58 24 pm

@hthetiot hthetiot requested a review from dpwspoon December 13, 2017 20:45
@hthetiot hthetiot self-assigned this Dec 13, 2017
@dpwspoon
Copy link
Contributor

This PR includes dist/* files. Please remove these. Follow up question, should the latest released dist/* file from the last release be on the develop branch? I would lean towards no, but I'm ok with it if that is better...

@hthetiot
Copy link
Contributor Author

@dpwspoon Done

@hthetiot hthetiot changed the title Features/worker support Features/config worker support and xhr channel support Dec 13, 2017
@hthetiot hthetiot added the wip label Dec 13, 2017
@hthetiot
Copy link
Contributor Author

Need to fix failing test

Uncaught Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's 'responseType' is '' or 'text' (was 'json')

@hthetiot
Copy link
Contributor Author

Need to fix karma tests

@hthetiot
Copy link
Contributor Author

hthetiot commented Feb 1, 2018

@jitsni Need to check with you for the possible related issue with encoding on http2.js

@hthetiot
Copy link
Contributor Author

hthetiot commented Feb 1, 2018

curl/curl#661 (comment)

@hthetiot
Copy link
Contributor Author

hthetiot commented Feb 1, 2018

Still having issues with gzip test-server using websocket + http2

@hthetiot
Copy link
Contributor Author

hthetiot commented May 29, 2018

@johnnykahalawai Merged with last http2-cache.js changes from develop.

@tejaede
For testing you can use:

Note: Worker and ArrayBuffer enabled by default or can be disabled with this:

XMLHttpRequest.configuration.useTransferable = false;
XMLHttpRequest.configuration.useWorker = false;

More Example: https://github.com/kaazing/http2-cache.js/blob/features/workerSupport/integration-test/http2-worker-itest.js#L342

cc @dpwspoon

@dpwspoon
Copy link
Contributor

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants