Skip to content

Support for browsers that don't support websockets #9

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

Open
puradox opened this issue Mar 31, 2016 · 11 comments
Open

Support for browsers that don't support websockets #9

puradox opened this issue Mar 31, 2016 · 11 comments

Comments

@puradox
Copy link

puradox commented Mar 31, 2016

I was browsing your code and noticed that you don't have any support for browsers that don't support websockets. So my assumption would be that this line would fail since there wouldn't be WebSocket() in the global namespace.

Are you planning to support for browsers that don't support websockets? Maybe switching to something similar to Socket.IO would be a good alternative. This would also solve your reconnecting problem (#7).

@puradox puradox changed the title Support for browsers that doesn't support websockets Support for browsers that don't support websockets Mar 31, 2016
@mikemintz
Copy link
Owner

You're right, this won't work on browsers without WebSocket, like IE9 and old android devices. I think @tjmehta is working on adding support or a fork that will allow alternative implementations to WebSocket. It would be great to have the option.

@tjmehta
Copy link

tjmehta commented Apr 4, 2016

I have a ton of work done with this: https://github.com/tjmehta/rethinkdb-primus --- init branch
I am currently writing browser tests for it.

If you're not wanting to use primus I have broken down @mikemintz work into a bunch of modules:
https://github.com/tjmehta/rethinkdb-validator-stream
https://github.com/tjmehta/rethinkdb-stream-chunker
https://github.com/tjmehta/validate-reql
https://github.com/tjmehta/ast-to-reql

@GeoffreyPlitt
Copy link

@tjmehta I'd rather not use primus, but I'm still interested in seeing this issue solved. I don't see any reference to Socket.io or Websockets in any of your links, did you omit that?

@tjmehta
Copy link

tjmehta commented Aug 4, 2016

Primus is an abstraction layer upon any "engine" of your choice. Primus can use engine.io(socket.io), socks, or websockets as its engine

@tjmehta
Copy link

tjmehta commented Aug 4, 2016

I got everything working, but reconnects are broken.

@GeoffreyPlitt
Copy link

@mikemintz While using this with React-Native, I found TcpPolyfill.js around line 59 was failing when data==={}. I fixed it with:
if(Object.keys(data).length===0) return; // ignore empty objects

I'm confused by how to clone this and test it out, due to the complicated nature of the prepublish/dist/files stuff, since I'm using this indirectly, the main module I'm including directly in my project is react-rethinkdb, which uses this module.

But it seems like a fix that should go in. Can you take a look, or should I send a PR?

@mikemintz
Copy link
Owner

@GeoffreyPlitt I think that change might break other cases, like if data is a base64 encoded string, like is checked on line 66. Can you describe why this check needs to be done, like what is the type of event sent that results in {} as data?

@GeoffreyPlitt
Copy link

What I do know is that I'm getting an error that says " 'list' argument must be an Array of Buffers" and it's impossible to debug very well, because of the nature of this module, how's it's compiled into the "dist" folder. I hacked some console.log statements into line 6000-something of this module in the the node_modules folder, and my suggestion above seemed to at least bypass this error.

Is there an easy way to avoid the prepublish/compilation step, and allow this module to be required from "src" and not be webpack'ed? That would allow me to debug it further.

@GeoffreyPlitt
Copy link

Here's a screenshot of my ReactNative error.

https://www.dropbox.com/s/e2rk6djnz5yeb7e/Screenshot%202016-08-08%2015.20.33.png?dl=0

@mikemintz Is there an easy way to avoid the prepublish/compilation step, and allow this module to be required from "src" and not be webpack'ed? That would allow me to debug it further.

@mikemintz
Copy link
Owner

@GeoffreyPlitt, if you're still having issues using react-native and rethinkdb-websocket-client, you can post on the related issue mikemintz/react-rethinkdb#11. It appears to be working on both android and iOS.

I don't know an easy way to avoid the prepublish step, as the way this library works heavily depends on webpack polyfilling TCP code.

@GeoffreyPlitt
Copy link

Cool, thanks

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

4 participants