CycleTLS icon indicating copy to clipboard operation
CycleTLS copied to clipboard

feat(transport): Add binary support

Open RealAlphabet opened this issue 1 year ago • 0 comments
trafficstars

This PR introduce breaking changes on the API and is currently a draft.

Currently the library constantly serialises binary responses in text (base64) which is extremely inefficient for certain types of response such as images and videos. This library introduces full support for binary responses by proxying the binary response data directly via WebSocket.

Breaking changes introduced

  • To introduce this behaviour, I had to change the messages communicated by the Go instance from JSON to binary. There are no other solutions for this type of data. This requires a user wishing to use CycleTLS from an external program to read the binary format returned by the WebSocket server.
  • The JavaScript library has been modified to read the binary data response sent by the CycleTLS WebSocket server. The methods return an object similar to the browser fetch API.

Future changes

  • [ ] Document the binary communication protocol.
  • [ ] Return an instance of IncomingMessage for NodeJS.
  • [ ] Support for cancelable requests via AbortController.
  • [X] Response Stream.
  • [X] Cancelable response.

RealAlphabet avatar Aug 10 '24 13:08 RealAlphabet