-
Notifications
You must be signed in to change notification settings - Fork 987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
6.1.0 and signalR not working #944
Comments
I'm not really sure what is causing it not to work but one thing I noticed is that it doesn't appear that you accept/respond to the When it comes to CORS, some requests will trigger a preflight request. In my nginx config I basically do:
I'm sure you can adapt that to IIS equivilant. Not sure if this will solve the issue with your event stream request, but I think it's worth a try. |
sorry for my late reply, i tried what you suggested, didn't work. but with further debugging and analyzing we discovered that signalr is being connected, but the cookies aren't being sent, so the server is refusing the connection. our authentication api is successfully returning a cookie to the client. but any other request that follows is not able to send a cookie. do you know a solution for this ? |
Ah, cookies is a common issue with wkwebview, ever since they implemented some kind of caching mechanism or something. I don't really know all the details. You could try reaching out to or cordova-ios channel on our slack on the cookie issue. |
well for now i used this plugin to sort out our cookies problem, cordova-plugin-wkwebview-inject-cookie . i can work with only IOS 11 for now, better than nothing, till we get a proper solution. |
cordova-ios@6 only supports iOS 11+ anyway. |
i guess this plugin documentation needs clarification or update, as they stated it works only on IOS 11. I tested it on IOS 13.5.1 and it works as it's supposed to. so maybe it could be a solution or walkaround for cookies in cordova-ios@6 |
I'll reopen this issue, I'm sure something can be done and we might be able and while we can't just use that plugin's codebase, we can draw inspiration from it. That plugin requires the developer to add: document.addEventListener('deviceready', () => {
wkWebView.injectCookie('mydomain.com/mypath');
}); I wonder if there is a way to have this done automatically. Unfortunately I don't have mac hardware to experiment or develop the feature, but I do think it is something worth investigating. |
Checking out this plugin it turned out not to be working correctly on iOS 13 (CWBudde/cordova-plugin-wkwebview-inject-cookie#7 (comment)). For the record... |
i'm sorry, i do not know what is not working on your end. Back end: my problem was: solution that worked for me was this plugin. how i solved it: i added the following:
and config.xml:
after that our server was able to access cookies and signal R connection was successful. |
i do not know what this plugin is doing to be honest, i have zero experience in objective-c. but as the following photo and for the following two requests, the response cookie is being sent |
How does the scheme 'http' work for you. When I put it in config.xml. it uses the default app scheme instead. |
|
and If I use a custom scheme like app:// dummy cookie injection does not work for me. So all subsequent xhr request using session cookies are receiving 401. |
I've marked this issue as stale because it's been over a year with no further comments. If this is still an issue in the latest cordova-ios version and an up-to-date iOS version, please let us know. Otherwise, this issue will be closed. |
Closing as stale. |
Description
hello guys, we are trying to upgrade cordova-ios to 6.1.0 since uiwebview is deprecated and wont be accepted on stores anymore. we had everything working on uiwebview. i managed to make XMLHttpRequest work with null origin, and we are able to make api calls again. but we are facing a problem with signalR, it seems that it's not able to connect. i am not able to figure out the problem.
What is expected to happen?
signalR to connect normally to the server.
What does actually happen?
signal R isn't able to connect.
Information
for a start i got this call:
although the status is 200 ok, it is marked in red, and the preview shows an error occured trying to load the resource.
then i get this 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.
now this is my config.xml:
i have these customheaders in my server Web.config
and i have this code in Global.asax.cs to handle the null origin:
and for my startup:
i tried enabling signalr cors but with no use and different error thrown about allow credentials to be different than true. i cant find the error or what is causing this problem if anyone can help me.
Environment, Platform, Device
Backend: .Net 4.5 webapi
cordova: 9.0.0
cordova-ios: 6.1.0
device: iphonex
device ios: 13.5.1
SignalR: 2.2.1.0
Checklist
The text was updated successfully, but these errors were encountered: