Test websocket app on iPhone, Python Flask-SocketIO and Javascript - javascript

My app, Python/Flask and vanilla Javascript, is running just fine on my Mac's browsers and I have previously also been able, making sure I'm on the right network, to test my app on Safari on my iPhone 6. I did this by pointing my mobile browser to the IP given by ifconfig on my Mac and correct port. However, after adding Flask-SocketIO, which should allow for Websocket support or atleast long polling, I am no longer able to test my app on my iPhone. All is still fine on Macs browsers but all I get on my iPhone is "Safari could not open the page...".
My app is served over port 5000 but Ive also tried over 80 without any success. I've cleared cache and cookies as well, of course.
Has anyone experienced something similar or have any idea what is going on?

Mobile Safari needs a Content-Security-Policy meta tag. See more at https://developers.google.com/web/fundamentals/security/csp/

Related

Server issue with iFrame on Apple device?

I'm trying to add iFrame to my Next.js app. It works well on Window, Android; however, on Apple devices, it shows server error: 500 Internal Server Error or Your sessions is not available on the server side anymore.
As far as I have tested, this happens on:
Phone browsers (Safari, Chrome)
Mac Safari
Chrome on Mac is fine
Does anyone have a fix?
I can't copy on Browser Stack, so here is the screenshot.
I guess the problem is that Apple block cookies. Anyway to bypass this?

Script not loading on iPhone

Recently I made my portfolio website and as I tested it today, everything works just fine on all of the most popular browsers. The problem is - I have access only to phones with Android and laptops with Windows. That way I am unable to test Apple devices and Safari itself.
For that, I asked my friend to visit my website on her phone (she has iPhone), so I can check if everything is ok. Unfortunately, when she entered my domain, Safari was unable to load JavaScript at all. What's even worse, she then installed Google Chrome and Mozilla Firefox, and the same stuff happened.
We were testing my website also on MacBook - that time also on Safari and Chrome. On Safari, there were some errors (it seems that at least part of the script worked), and on Chrome everything was right. I wasn't able to explore the problems, as we only had limited time via phone call.
Right now, my main issue is - why any browser on iPhone was unable to load the script? I would be very grateful if someone with iPhone or other Apple device could tell me what's happening there. The additional issue would be the Safari on MacBook. Because in this case, I was unable to detect anything useful, other than that only part of the script seems to be working.
Also, I don't know if that matters, but I used Webpack to bundle all JavaScript files. All code + domain can be found in the links below:
The website domain is: www.pmiecznik.pl
If you want to see those scripts/ style files - they are in the src folder in my GitHub repository.

SignalR on mobile web?

I'm evaluating SignalR technology for use in our new product (mobile web application for the broad audience, among other things it needs a real-time chat on some pages).
I've followed the guide to create a very basic chat demo.
Then I deployed the demo on my IIS, and started chatting to myself.
All clients were on the same WiFi network.
Desktop browsers worked more or less OK.
However, Safari on iOS 4.2, and IE on WP7.10 - they both sucked.
Sometimes nothing happened when I pressed the "post" button.
Sometimes outgoing messages were sent OK to the desktop firefox, however there was no incoming messages.
Maybe I'm missing something obvious? Maybe I need jquery mobile instead of the normal one? Maybe I should just tune the IIS/web.config/whatever, and the SignalR will flourish and start to work flawlessly even through the crappy mobile internet?
Or does it mean that since it doesn't work even while on WiFi within a single hop from the web server, I should throw SignalR away and just write some JavaScript to poll a JSON endpoint for new messages?
Thanks in advance!
I have been developing an app with phonegap (that means that uses the Safari browser) and SignalR for Android and IPhone. The major issue I had was with iOS 6.x because SignalR did not connect with default config. I have found a workaround for that and I had explained it here. Let me know if you find it useful.
This code will simulate a connect, check for messages, disconnect and wait 5 secs to solve the iOS issue.
In js add
$.connection.hub.start({ transport: 'longPolling' }).done(function (myHubConnection) { });
and in Application_Start() add
GlobalHost.Configuration.ConnectionTimeout = TimeSpan.FromSeconds(1);
Microsoft.AspNet.SignalR.Transports.LongPollingTransport.LongPollDelay = 5000;
RouteTable.Routes.MapHubs();
Not all mobile browsers (e.g. android, opera mini) support websockets. You'll find a nice chart of supporting browsers at http://www.hanselman.com/blog/YourUsersDontCareIfYouUseWebSockets.aspx

android can't see web service

I've written my first Android app (Sencha Touch + Phonegap using Eclipse on PC). It pulls some JSON from a WCF service. It works fine in the emulator.
I've now put it on my phone (Samsung GT-19100T running Gingerbread). The app runs but hangs when calling the service. The phone just shows the loading animation. The server shows no request has reached it. The phone can browse the net ok.
EDIT: I should add that the problem is not the server. I can browse to the same services ok on PC, and we have an iPhone app that works with it fine.
The only other strange thing I've noticed is that if I browse to the endpoint on iPhone or PC, I get the JSON text in the browser. If I try it on the android's browser it says "cannot download".
How do I go about diagnosing this?
Is there some sort of option on the phone?
found it. The answer is to SHOOT ME NOW.
the URL had been entered so long ago I forgot all about it, including little details like the fact that it used an internal ip address.
Total facepalm. No, that won't do it. Let's try a facedesk...

Problem with DWR and Android-Browser

I am experiencing a problem with accessing an application from the Android-browser.
The application uses DWR to persist connections to the clients that are connected with it.
Everything works fine for me, except that if the application does not send any data to the client on the Android-phone for 2 minutes, the connection seems to be lost and no data arrive at the client. The same scenario works just fine on Firefox, Opera and Chrome. If the pause between two data transfers is less than 2 minutes, it works just fine.
So, now my question:
Is there some timeout setting for the android browser that I am missing? Or is this some built-in bug/feature/whatever that I cannot circumvent?
I know that I could prevent this from happening with some sort of heartbeat, I would just like to why this is happening.
Thanks in advance, Max
btw: Everything (server, clients) runs on my machine and I am testing this on the android emulator with Windows XP
Android emulator version 1.10 (build_id CUPCAKE-150240)
Could it be that the Android system is garbage collecting your activity and thus loosing your web browser and closing the persistent connection?
Perhaps you could check this by looking in you logcat (on android end) or webserver logs (on remote end)?
if this is the case, you would need to add reconnect code into the onresume/onstart method in android.

Categories