Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsocket can not run in browser #280

Closed
sheiy opened this issue Jul 30, 2024 · 4 comments
Closed

rsocket can not run in browser #280

sheiy opened this issue Jul 30, 2024 · 4 comments

Comments

@sheiy
Copy link

sheiy commented Jul 30, 2024

image
@sheiy
Copy link
Author

sheiy commented Jul 30, 2024

"rsocket-core": "^0.0.29-alpha.0",
"rsocket-websocket-client": "^0.0.29-alpha.0"

@SoylentTheGreen
Copy link

SoylentTheGreen commented Jul 31, 2024

this is also a problem in in 1.0.0-alpha.3 I've had to add it in a polyfill.ts

`import { Buffer } from 'buffer';

window.Buffer = Buffer;
`
from https://github.com/feross/buffer

but I still cannot get it working as I'm getting a "No handler for destination ''" warning and I'm not sure if it's a problem with the way the buffer is encoding the route.

actually, this is a duplicate of #267

@sheiy
Copy link
Author

sheiy commented Aug 1, 2024

@SoylentTheGreen Thanks for your reply. It looks like this project is not actively developed

@sheiy sheiy closed this as completed Aug 1, 2024
@viglucci
Copy link
Member

viglucci commented Aug 2, 2024

Hey y'all, for 1.0.0-alpha.3 it is expected that you need to provide a buffer polyfill for usage in browser contexts. I'm not sure if simply setting window.Buffer is sufficient, however I've had success using webpack following methods such as this: https://viglucci.io/articles/how-to-polyfill-buffer-with-webpack-5. Additionally, there is an example showing a minimal setup using webpack to produce a bundle that runs in a Browser context. You can find that here: https://github.com/rsocket/rsocket-js/tree/1.0.x-alpha/packages/rsocket-examples/src/webpack/browser-bundle .

Apologies that I cannot speak much to the 0.0.X versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants