Question

We are using Pusher on mobile devices (using html webview + javascript).

I am connecting to Pusher using the following script (loaded async to the page)

http://js.pusher.com/2.1/pusher.min.js.

and then initialise Pusher object:

var externalTrackingProvider = new Pusher(config.key, { encrypted: true });
var connection = externalTrackingProvider.connection;
connection.bind('connected', function() {
console.log("connected");
});

The process works well but the time between "new Pusher" and "connected" event can take up to 15!!! seconds on mobile devices. The average time between init and connected is 5-10 seconds. (the js file itself is pre-loaded so this is the actual connection time).

Our testing is done using high speed wifi network so this is not the issue here.

Is this a knows Pusher issue? Anything to be done in order to fix this?

EDIT Following Mike's advise, I tested "http://test.pusher.com" using our webview on Samsung Galaxy S4, high speed wifi connection. The results are avarage of 3-4 seconds between "connecting" and "connected". Attached screenshot.enter image description here

Edit2: After sending the logs to Pusher it appears that Android webview does not support Websockets, which causes a js fallback which results in poor performance.

The solution should be some kind of webview websocket library

I'll try and update if it is working

Was it helpful?

Solution

It should all be done in well under a second. You can use test.pusher.com with the same browser and network connection to see the messages passed back and forth and at what stage the latency is being introduced. Some fallbacks where websocket connections fail require the loading of further code, may involve a timeout to consider the initial attempt failed and require more round-trips than a websocket in order to create a connection.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top