surf icon indicating copy to clipboard operation
surf copied to clipboard

WASM Polish

Open yoshuawuyts opened this issue 6 years ago • 4 comments

#25 introduces a minimal WASM backend for Surf. In order to make it production ready, we should:

  • [x] support different methods on request
  • [ ] support body uploads
  • [ ] remove all unwraps
  • [ ] set headers on request
  • [x] get headers from response
  • [x] create an internal fetch client abstraction to get ready to move the bulk of the code to gloo

Thanks!

yoshuawuyts avatar Aug 06 '19 10:08 yoshuawuyts

It would also be nice to have the ability to abort/drop requests in WASM environments. I'm not sure if this is possible with Hyper but I can think of a number of cases where aborting requests would be useful in a browser.

liamcurry avatar Aug 25 '19 14:08 liamcurry

@liamcurry for sure; we could do this as a Drop impl on runtime-wasm using the fetch observer API. We'd need to do some runtime feature detection though because it's not universally available in browsers, but it would def be cool to have!

yoshuawuyts avatar Aug 26 '19 16:08 yoshuawuyts

@yoshuawuyts Would it make sense to use XHR instead since that is available in all browsers? From what I can tell the only difference between the two is that fetch uses promises, which would be irrelevant here. Asynchronous XHR requests seem to be allowed in Service Workers too.

liamcurry avatar Aug 26 '19 17:08 liamcurry

@liamcurry my understanding is that spec authors consider XHR to be deprecated in all but name, so I feel it might make most sense for us to keep building on fetch — even if not all features are equally available everywhere.

yoshuawuyts avatar Aug 27 '19 14:08 yoshuawuyts