rsocket / rsocket-js

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

WebsocketTransportClient is not a constructor #254

Closed mattydono closed 1 year ago

mattydono commented 1 year ago

image

Expected Behavior

instantiate a new WebsocketClientTransport class with constructor args of ClientOptions

Actual Behavior

WebsocketClientTransport registers a type error

Steps to Reproduce

packages:

image

attempt to instantiate new WebsocketClientTransport class

viglucci commented 1 year ago

Hi @mattydono

Could you please provide a reproduction example?

I wasn't able to reproduce this through a simple example/test. Please see: https://github.com/viglucci/rsocket-js-websocket-example

Based on your screenshot, I suspect you are trying to use RSocket-js in a client-side application. Are you using Webpack, Vite, or another bundler?

mattydono commented 1 year ago

So the only notable difference is that I'm using RxRequestersFactory:

image

image

edit: I'm now receiving:

image

resulting from the above, I've only began to run into issues since trying to move away from flowables.

viglucci commented 1 year ago

Thanks for that additional info.

Can you answer this question:

Based on your screenshot, I suspect you are trying to use RSocket-js in a client-side application. Are you using Webpack, Vite, or another bundler?

RSocket used to provide an alternative implementation of Buffer, however this is no longer the case in v1.X.

This article may help: https://viglucci.io/articles/how-to-polyfill-buffer-with-webpack-5

You can also reference the WebPack example: https://github.com/rsocket/rsocket-js/blob/8f862ad6c6c72e54728966d352b5959f1534af25/packages/rsocket-examples/src/webpack/simple/client/webpack.config.js#L22

mattydono commented 1 year ago

I'm using vite, reading into the above

viglucci commented 1 year ago

Concerning vite, you may also wish to reference this previous issue: https://github.com/rsocket/rsocket-js/issues/195#issuecomment-987510972

viglucci commented 1 year ago

Hey @mattydono were you able to find a solution here? If so I would like to close out this issue.

viglucci commented 1 year ago

Closing this out as haven't heard back from Author.