Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

Android & Websockets #448

Open
thisandagain opened this issue Oct 22, 2014 · 4 comments
Open

Android & Websockets #448

thisandagain opened this issue Oct 22, 2014 · 4 comments
Labels

Comments

@thisandagain
Copy link

Within webviews on Android < 4.4 we hit an issue with makedrive in that WebSockets are not supported. Specifically, we get a fatal exception on line 10 of client-ws.js:

global.WebSocket.prototype.on = global.WebSocket.prototype.on || function(event, listener) {
10-21 21:10:43.459: E/Web Console(18005): Uncaught TypeError: Cannot read property 'prototype' of undefined

I realize that it may not be possible to resolve this in its entirety, but it could be helpful to have makedrive return an error to the client for handling vs. throwing when WebSocket is undefined.

@alicoding
Copy link
Collaborator

So, when you mentioned Webview is that the default browser app from Android on Kitkat correct? The reason I asked here is that it might not be possible to solve this using our current Websocket impl, but I believe if anyone using Chrome or Firefox browser app will be able to run MakeDrive with Websocket no problem.

@alicoding
Copy link
Collaborator

@thisandagain can you comment on the conversation we had about socket.io and sockjs again? I can't recall about this.

@thisandagain
Copy link
Author

In Android prior to version 4.4, Websockets are not supported in either the Webview class or in the default browser that ships with the OS. Because of this, we'll want to look at using a library that provides a polyfill. I've worked with a bunch of these in the past (like socket.io and sockjs) but don't have any strong recommendations particularly given that socket.io was just recently redesigned.

One thing that we might want to look at is Primus which isn't a websocket polyfill / library per-se as much as it is an abstraction to help prevent against lock-in. This could be particularly helpful with testing!

See:
https://medium.com/@denizozger/finding-the-right-node-js-websocket-implementation-b63bfca0539

@humphd
Copy link
Contributor

humphd commented Nov 4, 2014

Interesting discussion of socket.io + FFOS 2.0 + Flame https://groups.google.com/forum/#!topic/mozilla.dev.platform/X7fGhVL_NrI

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

No branches or pull requests

3 participants