ludei / webview-plus

Uniform webview on any Android 4.x device.
103 stars 16 forks source link

Unable to connect to multiple WebSockets #4

Open debianw opened 10 years ago

debianw commented 10 years ago

Hey, I just realized that Webview+ is unable to connect to multple websockets.

Environment: cocoonjs version: 1.0.0-0.5.0 Webview+ version: 2.0.0

I create a demo in order to reproduce this issue. (https://github.com/debianw/cocoonjsAndWebsockets)

Basically it creates 2 websocket connections to wss://echo.websocket.org/ and send a message. Webview+ can just handle 1 socket connection and doesn't accept more websocket connections.

you can try this code too into chrome inspector and you'll see how 2 websockets are created and send an echo message with success.

var w = new WebSocket("wss://echo.websocket.org/")
  , w2 = new WebSocket("wss://echo.websocket.org/");

w.id = 10;
w2.id = 11;

w.onopen = onOpen;
w.onmessage = onMessage;
w.onclose = onClose;
w.onerror = onErr;

w2.onopen = onOpen;
w2.onmessage = onMessage;
w2.onclose = onClose;
w2.onerror = onErr;

function onOpen () {
  console.log('connected: ', this.id);
  this.send('hello websocket! '+ this.id);
}

function onMessage (e) {
  console.log(e.data,' ',this.id);
}

function onErr (e) {
  console.log(e.data, ' ', this.id);
}

function onClose () {
  console.log('disconnected: ', this.id);
}
ludei commented 10 years ago

Thanks for your bug report, we are taking a look at this.

debianw commented 10 years ago

you're welcome, thanks

debianw commented 10 years ago

hey guys, just want to know the status of this, did you reproduce the issue ?

ludei commented 10 years ago

Hey Debianw

We found that your test case works in Google Chrome for Android, but not in the Webview+, so we think that the next update to the latest chromium source code will solve this issue.

I can't give an precise date at the moment of when we'll update the Webview+, but I'll keep you informed.