rsocket / rsocket-js

JavaScript implementation of RSocket
https://github.com/rsocket/rsocket-js
Apache License 2.0
604 stars 97 forks source link

WebsocketClientTransport is incompatible with browser environments #183

Closed viglucci closed 3 years ago

viglucci commented 3 years ago

Attempting to compile WebsocketClientTransport (for example w/ Webpack) from @rsocket/rsocket-websocket-client results in an exception.

../../../rsocket-js/node_modules/ws/lib/sender.js:5:0
Module not found: Can't resolve 'net'

Import trace for requested module:
./..\..\..\rsocket-js\node_modules\ws\index.js
./..\..\..\rsocket-js\packages\rsocket-websocket-client\dist\WebsocketClientTransport.js
./..\..\..\rsocket-js\packages\rsocket-websocket-client\dist\index.js
./pages\index.js

In the current 0.0.26 version of rsocket-websocket-client the WebSocket implementation defaults to the global WebSocket available in browsers. 1.0.0 has since been changed to default to WebSocket made available by the ws module. We should likely revert this behavior to again default to browser compatibility, with non-browser compatibility provided via wsCreator.

viglucci commented 3 years ago

closed by https://github.com/rsocket/rsocket-js/pull/184