locked
connectivity issue with cordova ios 6.1.0 RRS feed

  • Question

  • User-1534883655 posted

    hello guys, we are trying to upgrade cordova-ios to 6.1.0 since uiwebview is deprecated and wont be accepted on stores anymore. but after upgrading we faced a connectivity issue with signalr that we didn't have before. excuse me, but all i have is this, since i don't know what our problem is.

    for a start i got this call:

    Summary
    URL: http://192.168.47.105:55554/signalr/connect?transport=serverSentEvents&clientProtocol=1.5&connectionToken=OC0LMC6PzDP%2BbksoG4PF3OlmAX6ScrTdg3yOxtaZFnHAspQjvqfFpDSCIWJGLNME%2FlCUg86Vpg1h12VOoR2uB0b2LyBVPbsRU%2BVo%2BNONkFIgdFfNcVahRec6xURdjwMs&connectionData=%5B%7B%22name%22%3A%22kindoohub%22%7D%5D&tid=9
    Status: 200 OK
    Source: Network
    
    Request
    Accept: text/event-stream
    Cache-Control: no-cache
    Origin: null
    User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
    Pragma: no-cache
    
    Response
    Content-Type: text/event-stream
    Access-Control-Allow-Origin: null
    Pragma: no-cache
    Access-Control-Allow-Methods: GET, POST
    Expires: -1
    Transfer-Encoding: Identity
    Access-Control-Allow-Headers: Content-Type
    Cache-Control: no-cache
    Date: Wed, 15 Jul 2020 12:37:22 GMT
    Access-Control-Allow-Credentials: true
    X-Content-Type-Options: nosniff
    X-AspNet-Version: 4.0.30319
    X-Powered-By: ASP.NET
    Server: Microsoft-IIS/7.5
    
    Query String Parameters
    transport: serverSentEvents
    clientProtocol: 1.5
    connectionToken: OC0LMC6PzDP+bksoG4PF3OlmAX6ScrTdg3yOxtaZFnHAspQjvqfFpDSCIWJGLNME/lCUg86Vpg1h12VOoR2uB0b2LyBVPbsRU+Vo+NONkFIgdFfNcVahRec6xURdjwMs
    connectionData: [{"name":"kindoohub"}]
    tid: 9

    although the status is 200 ok, the call is marked in red as it failed, and preview give this: an error occurred trying to load the resource

    and then i have this error in console:

    XMLHttpRequest cannot load http://192.168.47.105:55554/signalr/abort?transport=serverSentEvents&clientProtocol=1.5&connectionToken=OC0LMC6PzDP%2BbksoG4PF3OlmAX6ScrTdg3yOxtaZFnHAspQjvqfFpDSCIWJGLNME%2FlCUg86Vpg1h12VOoR2uB0b2LyBVPbsRU%2BVo%2BNONkFIgdFfNcVahRec6xURdjwMs&connectionData=%5B%7B%22name%22%3A%22kindoohub%22%7D%5D.

    i have these custom headers in Web.config:

    <customHeaders>
            <add name="Access-Control-Allow-Headers" value="Content-Type" />
            <add name="Access-Control-Allow-Methods" value="GET, POST" />
            <add name="Access-Control-Allow-Credentials" value="true" />
    </customHeaders>

    and in Global.asax.cs i have this code to handle a null origin from cordova-ios:

     protected void Application_BeginRequest(object sender, EventArgs e)
            {
                if (Context.Request.UrlReferrer != null)
                    HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", Context.Request.UrlReferrer.GetLeftPart(UriPartial.Authority)); //browser
                else
                    HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "null"); //wrapper
    
            }

    and for the startup i have this:

    public class Startup
        {
    
            public void Configuration(IAppBuilder app)
            {
                try
                {
                    string redisIP = ConfigurationManager.AppSettings["RedisIP"].ToString();
                    int redisPort = int.Parse(ConfigurationManager.AppSettings["RedisPort"].ToString());
                    GlobalHost.DependencyResolver.UseRedis(redisIP, redisPort, null, "SignalRChat");
    
                    app.Map("/signalr", map =>
                    {
    
                        //map.UseCors(CorsOptions.AllowAll);
                        var hubConfiguration = new HubConfiguration
                        {
                            EnableDetailedErrors = true,
                            EnableJavaScriptProxies = true,
                        };
                        // Run the SignalR pipeline. We're not using MapSignalR
                        // since this branch already runs under the "/signalr"
                        // path.
                        map.RunSignalR(hubConfiguration);
                    });
                }
                catch (Exception ex)
                {
                    File.WriteAllText(@"C:\Logs\ex" + DateTime.UtcNow.Ticks.ToString() + ".txt", ex.Message + " " + ex.StackTrace);
                }
            }
    
        }

    i tried enabling cors, but with no use and get a different error stating that Access-Control-Allow-Credentials is not set to true .

    now this problem i am facing is only occurring on ios devices with cordova-ios 6.1.0.

    on android and safari and chrome working normally

    Wednesday, July 15, 2020 1:34 PM

All replies