Xamarin forms Webview via websocket - xamarin

I developed xamarin forms application with WebView which routing to page with signalR websocket. And when page is loaded connection doesn't start. I have read about android.webview doesn't support websocket. Can someone give me advice about implimintation of websocket via webview. maybe use custom webview or something else.

I read that webview doesn’t allow WebSocket on android version less then 4.0. In my case my webview cached the page that I used before added the WebSocket and when I clear the cache all works fine

Related

Firebase web push notification in iframe is only working in firefox

I am using firebase for web push notification it is working perfect when I used it in same domain, but I have only one ssl domain and many non ssl website. So I have plan to use it in iframe and integrate this facility in all my non ssl websites too.
URL is
https://htmlcodeplay.com/notification/notification/index.html?websiteid=3
I have integrate it through iframe like below
<iframe src='https://htmlcodeplay.com/notification/notification/index.html?websiteid=3'></iframe>
I have integrate this lines into my blogger https://allinworld99.blogspot.in. But it is working perfectly in Firefox browser but not in chrome browser. No errors also displayed.
As per this link Does my web application require SSL for Firebase Cloud Messaging for Web to work?. It should not work, but how it is working in firefox browser.
I am not able to find a reference right now, but you want to do
embed a "push notification webpage" inside another via iframe
is blocked by Chrome for security reasons.

Authentification with Google (to get rtmp url) without using WebView in a Xamarin Project ?

I'm trying to develop a Xamarin project wich is able to stream on youtube.
I want to get the rtmp url from the user account.
But, recently google has disabled webviews to authorize apps to get accesstoken and others user data.
I have tried to use Xamarin Auth but unfortunately, it actually use a webview.
(getUI() is returning a webview).
So i'm asking if someone know how to authentificate a user with google without webviews ?
I have also tried using custom tabs but I can't get the url to get the access token because the NavigationEvent is not fired when a new page is loaded.
Xamarin.Auth 1.4.x supports Custom Tabs and SafariViewController, but no Xamarin.Forms support what most of the users want.
Xamarin.Forms support is in the 1.5.0-alpha soon to be released.
Samples extracted from the repo:
https://github.com/moljac/Xamarin.Auth.Samples.NugetReferences
Try ComicBook (Xamarin.Forms) or Providers (Traditional/Standard).
Nuget packages tuning can be problematic, just bump versions to the highest.

Fake websocket function in Android browser

I want to run websocket in a browser to connect to a server, or use flash when ws is not available (like what websocket.js does)
but it seems there is a native WebSocket function in an android browser (not chrome), the function has member functions such as close, send etc but it does not work. I can't capture any ws packages on the router when trying to use the native ws to connect to a server.
So,
why the fake ws function exists .........
I'll try to check binaryType of this object, when binaryType is undefined or "" I think it is not a good ws (including ws ver 7-8, servers support only ws ver 13). Is this exact? or anyway better? UserAgent may be a not good idea, because there are lots of custom browsers on android (such as firefox, dolphin, ...), and there is not a good key word to check in UA
when or in which version will the fake ws function of android browser disappear or become real? Although google recommands chrome, but some phones seem running default browser with an icon like the earth instand of chrome.
Thanks a lot!
It seems that Google started work on implementing WebSocket in the Android browser, but only got as far as the API.
The fake API exists across all newer versions of the Android browser, irrespective of vendor. This only changes with Android 4.4, where the Android browser has been replaced with Chrome.
I would not suggest detecting this by user agent or like, but instead detect through the behavior of the fake WS object.
E.g. when opening a trial WebSocket connection, the 'readystate' on the Android browser WebSocket object always remains at '0', whereas with a working implementation it changes.
See also this related question.
Which version of Android are you using?
According to CanIUse.com, the only Android browser that supports Websockets is the 4.4.
Cheers.

How to handle HTML5 Web Notifications with a Cocoa WebView?

I use a Cocoa WebView to display a website which sends HTML5 Web Notifications. When browsing this page using Safari, I receive User Notifications directly in the Notification Center of Mac OS X Mountain Lion.
How I can achieve the same behavior by implementing my own WebView ? I didn't see any delegate methods related to this feature.
Edit: If this can help someone:
https://github.com/jnordberg/irccloudapp/blob/master/NotificationProvider.m
Thanks to Johan Nordberg for sharing this.
There is no public API for web notifications in WebKit on OS X at this time. You should file an enhancement request with Apple requesting that the functionality be exposed. However, since WebKit is open source you can easily find the private interface on WebView that relates to displaying web notifications. As with all private interfaces, it's subject to change without notice and may not be used within an application in the App Store.

Session state persistence between web page content and XmlHttpRequest for Mac dashboard widgets and Safari extensions

I already posted to Apple's Safari dev forum but got no responses so thought try cross posting elsewhere to get ideas:
I'm asking this question in regards to both
Safari Extension (toolbar type AJAX extension)
Mac OS X dashboard widget
I assume both will be similar as they use the WebKit rendering engine?
I would like to know if the engine for maintaining built in session state support (cookies?) shares and persists the session between web content loaded on the page by the browser engine (HTML, JS, CSS, images, etc.) and requests made by XmlHttpRequest object.
I'm porting an AJAX app that requires session state that's shared between web content and XmlHttpRequest object. (i.e. no explicit cookie management for session state, at least not defined by the web service API that I use).
I successfully ported the app to Chrome, Opera, Windows 7/Vista gadget. It failed to work on iGoogle, and Mac OS X widget. Safari extension port had mixed results - it works in some cases but not in others.
I also did a Microsoft .HTA port (HTA app = web app to be run via IE w/o security restrictions of normal web apps, like cross domain XmlHttpRequests) and noticed that works only with IE7+ (due to implementation differences of native XmlHttpRequest in IE7+ vs MS XML version of earlier IEs)
I had consulted discussion/support group for iGoogle as well and learned that iGoogle too doesn't support such session state support.
I kind of worked around iGoogle issue by using Flash component to perform XmlHttpRequests which seemed to be able to share the overall browser session and thus work. I'm attempting that for Mac widget, it didn't seem to work. Can Safari toolbar extensions make use of Flash?
In any case posting this thread for more insight like if Safari/Mac is like iGoogle and not support a shared session between web content and XmlHttpRequest (or no cookies even supported).
FYI, the app I'm working on is below, you can try out what I have to investigate issue. When session state support fails, you get error message that need to enter code correctly (that's what the web service returns in this case, not very helpful to the user).
http://code.google.com/p/autosmsclients/
I've already hosted code for Mac OS X widget and Safari extension there.

Resources