rsocket / rsocket-js

JavaScript implementation of RSocket

Home Page:https://github.com/rsocket/rsocket-js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WebsocketClientTransport is incompatible with browser environments

viglucci opened this issue · comments

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.

closed by #184