Support browser environments
Is your feature request related to a problem? Please describe. It would be great to use this library in "browser-compatible" environments: Chrome, Cloudflare Workers, or Deno. This would open up this library to be used by a wider variety of platforms.
Describe the solution you'd like
At runtime, the library would check if its in a Node environment; otherwise, it would use polyfills or browser native APIs like WebCrypto or fetch.
Additional context Any TCP-related code would use the Raw Sockets API which is already implemented on Chrome and will soon be added to other platforms.
hi, browser environment are already supported with the connect option of createClient which allows users to provide their own sockets. bundlers like browserify and webpack already allows replacing node APIs by browser shims I guess it would be useful to add an example to demo it though
This has been used in a few projects but without much success as until now the only way for this to be useful was to use websocket. What versions of chrome has this raw sockets API? is it enabled by default? what about security ?
It seems to be in development for chrome and not really near to reach a consensus with other browsers https://www.chromestatus.com/feature/6398297361088512
It raises a lot of security concerns, I wonder if and how they'll standardize it. Definitely something interesting to follow.