Search Unity

UniWeb

Discussion in 'Assets and Asset Store' started by simonwittber, May 23, 2013.

  1. PaulGregory

    PaulGregory

    Joined:
    Sep 22, 2013
    Posts:
    4
    Regarding SetHeader and GetHeader...

    To save other users a bit of bother, you should update the readme.txt - the example "How to do a HTTP GET request" still uses SetHeader and GetHeader.
     
  2. subvertio

    subvertio

    Joined:
    Dec 3, 2010
    Posts:
    127
    Terrain Destructor seems to make permanent Damage to terrain, when I reload the level it is still there? I tried loading an empty level and reloading level but terrain damage from previous game is still there...How do I clear damage?
     
  3. scone

    scone

    Joined:
    May 21, 2008
    Posts:
    244
    Hey there. I'm having some crossdomain issues. I'm trying to create a webplayer build that can access another server running ElasticSearch. I've created a crossdomain.xml as per http://docs.unity3d.com/Documentation/Manual/SecuritySandbox.html and it is accessible at the domain root.

    I've tried running Elasticsearch on port 9200 (deafult) and port 80, apache (hosting the crossdomain.xml) on port 80, 9000, and 843. I'm able to successfully request the crossdomain.xml file itself, but nothing else. I've also tried using the Security.PrefetchSocketPolicy function. This functino takes a while, which might indicate that it's failing.

    The server is hosted on EC2 and I've added all TCP and UDP ports to the inbound rules of the security group.

    I'm pretty stumped. Any ideas? I can't seem to get the policy debugging environment variable to work, either.


    Edit: Neevermind. I was trying to host my socket policy with apache. Apperently that's not cool. Got it working now :)
     
    Last edited: Dec 14, 2013
  4. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Reading response.status seems after a send gives an iterator error in the coroutine.

    UnityEngine.Debug:Log(Object)
    <MYCOROUTINE>c__Iterator14:MoveNext() (at Assets/Script/test.cs:445)
     
  5. jogo

    jogo

    Joined:
    May 31, 2013
    Posts:
    17
    How could I start implementing ServerCertificateValidationCallback? I've never done that before ...
     
  6. opwallin

    opwallin

    Joined:
    Dec 27, 2013
    Posts:
    17
    Hi,

    does your plugin support sending http multipart post messages over TCP stack in Webplayer ?
     
  7. MaT227

    MaT227

    Joined:
    Jul 3, 2012
    Posts:
    628
    Hello everyone,

    I wish you a Happy New Year 2014 ! :-D
    I am using UniWeb 1.9.19 with Unity Pro 4.2.2f1.

    Everything is working fine but I wonder how can I use Assetbundles with UniWeb. Especially the WWW.LoadFromCacheOrDownload feature.
    Is there any control on cache with UniWeb ?

    The bad news, is that I am having an error with a simple code.
    Code (csharp):
    1.  
    2. AssetBundle bundle = request.response.Asset.assetBundle;
    3. bundle.Unload(false); // NullReferenceException
    4.  
    I don't know where does it comes from and how to fix it. I can't use simple WWW requests because I need cookie handling for authentication.
    I tested it with Postman and the request works but fails with UniWeb. And if I print the Bytes length I get the correct assetbundle size.

    If I make direct request to my Azure Blob Storage I get this error using UniWeb.
    400 Authentication information is not given in the correct format. Check the value of Authorization header.

    Maybe there are more controls on Assetbundles in the 2.1.3 version ?
    Thanks a lot.
     
    Last edited: Jan 2, 2014
  8. Ciprian

    Ciprian

    Joined:
    Jul 9, 2013
    Posts:
    27
    Hi Simon

    I am still not sure if it's possible to use PUT and DELETE requests with UniWeb.. can you please let me know and provide an example?

     
  9. Ciprian

    Ciprian

    Joined:
    Jul 9, 2013
    Posts:
    27
    So, for anyone searching on how to make a PUT/DELETE request with UniWeb, here is what I did:

    In Uniweb's Request.cs class, I added this constructor:

    public Request (string method, string uri, WWWForm form)
    {
    this.method = method;
    this.uri = new Uri (uri);
    this.bytes = form.data;
    foreach (string k in form.headers.Keys) {
    headers.Set (k, (string)form.headers [k]);
    }
    }

    I am simply calling:

    var r = new Request("DELETE", "http://api", form);

    or

    var r = new Request("PUT", "http://api", form);

    Haven't figured out if I can use a pre-existing method, but if I won't stand corrected, I would kindly ask you to add this constructor to the library

    Cheers
     
  10. MaT227

    MaT227

    Joined:
    Jul 3, 2012
    Posts:
    628
    Is this package dead ? No answer from the publisher from a long time...

    I am making a simple GET request to an Azure Blob Storage to retrieve an AssetBundle but the content of the response's assetbundle is always Null.
    This size of the response is good and the status too.
    Is there ant And there any handling of assetbundle cache with UniWeb ?
    I need to use UniWeb because of an authentification system using cookies.

    Does anyone already had this issue ?

    Code (csharp):
    1. url = "assetbundle_azureblobstorage_url";
    2. Request request = new Request("GET", url);
    3. request.Send();
    4.            
    5. while (!request.isDone)
    6. { Debug.Log(request.Progress); yield return new WaitForEndOfFrame(); }
    7.  
    8. if (request.exception != null)
    9. {
    10.     Debug.LogError("Download exception: " + request.exception);
    11. }
    12. else
    13. {
    14.     switch (request.response.status)
    15.     {
    16.     case 200:
    17.         AssetBundle bundle = request.response.Asset.assetBundle;
    18.         Debug.Log(bundle); // This is Null
    19.         break;
    20.     default:
    21.         Debug.Log("Download unhandled error: " + request.response.status + " " + request.response.message);
    22.         break;
    23.     }
    24. }
    25.     }
     
    Last edited: Jan 20, 2014
  11. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226
    Hi, definitely not dead! It seems the forum stopped mailing me notifications. Will look into this now.
     
  12. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226
    Yes, but you will need the crossdomain server described in the manual running on your host.
     
  13. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226
    Not sure why you needed this, you can already use any HTTP method with UniWeb.
     
  14. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226
    Can you send me some code via email to help diagnose this? I've just tested with this coroutine and it works as expected.
    Code (csharp):
    1. IEnumerator FetchAssetBundle() {
    2.         var r = new HTTP.Request("GET", "http://differentmethods.com/~simon/uniwebtest.unity3d");
    3.         yield return r.Send();
    4.         if(r.exception == null) {
    5.             Debug.Log(r.response.status);
    6.             yield return r.response.Asset;
    7.             Debug.Log(r.response.Asset.assetBundle);
    8.         } else {
    9.             Debug.LogError(r.exception);
    10.         }
    11.     }
     
  15. axsyon

    axsyon

    Joined:
    Jun 4, 2013
    Posts:
    2
    Hi,
    I've been getting this XCODE error lately whenever i send a request on our server using Uniweb.
    I think it's not really Uniweb that causes this eror but it only triggers it.
    I've read this problem at this link but I'm just wondering if someone else also had this problem.

    Thanks!
     
  16. MaT227

    MaT227

    Joined:
    Jul 3, 2012
    Posts:
    628
    A small post to thank Simon for his great support on UniWeb.
    A very good package with a very good developer.
    Great job ! :-D
     
  17. brandon.sk

    brandon.sk

    Joined:
    Feb 11, 2014
    Posts:
    1
    I'm having a similar issue. Did anyone figure what's going on or a solution?

     
  18. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,043
  19. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    955
    Not sure if this appropriate here, but I really think this can be useful for quite a lot of people...

    Some time ago, I've released an asset that allows to use .NET sockets on iOS/Android without the need for Pro licenses, and, of course, UniWeb was one of the reasons I've did it :)

    So, here it is:
    Good ol' Sockets
    UniWeb works with this asset in just a single click. After that it'll just work on iOS and Android even without mobile Pro license.

    Hope this will come in handy for non-Pro mobile developers who want to use UniWeb :)
     
  20. henkjan

    henkjan

    Joined:
    Aug 1, 2013
    Posts:
    131
    Hi,

    I've been reading this thread (and the crossdomain explained blog) because I have crossdomain issues. But I can't figure out the correct solution for me.

    I'm trying to call my ASP.NET WebAPI service (which is a REST Service) hosted in IIS (7) and this works fine when using Android, but I get the (now famous) error message:
    ------------------------
    Unable to connect, as no valid crossdomain policy was found
    at System.Net.Sockets.Socket.Connect_internal (IntPtr sock, System.Net.SocketAddress sa, System.Int32 error, Boolean requireSocketPolicyFile) [0x00000] in <filename unknown>:0
    at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP, Boolean requireSocketPolicy) [0x00000] in <filename unknown>:0
    at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0
    at System.Net.Sockets.TcpClient.Connect (System.Net.IPEndPoint remote_end_point) [0x00000] in <filename unknown>:0
    at System.Net.Sockets.TcpClient.Connect (System.Net.IPAddress[] ipAddresses, Int32 port) [0x00000] in <filename unknown>:0

    -------------------------

    In the root of my server I placed a crossdomain.xml file containing:
    <?xml version="1.0"?>
    <cross-domain-policy>
    <allow-access-from domain="*" secure="false"/>
    </cross-domain-policy>


    In Unity I do this:

    var url = "http://mobile.e-learner.nl/api/users/Authenticate";
    var request = new Request("Post", url);
    request.headers.Add("Content-Type", "application/json");
    var user = new Identity
    {
    Username = UsernameInput.value,
    Password = PasswordInput.value
    };
    request.Text = JsonConvert.SerializeObject(user);

    yield return request.Send();
    if(request.exception != null)
    Debug.Log(request.exception)

    .................

    Also I've tried to add: Security.PrefetchSocketPolicy("194.126.71.221", 80);
    (For testing purposes I don't user HTTPS but when going in production in the future I will use SSL)

    Nothing that I do seems to help so I'm stuck for now.

    What do I do wrong here?
     
    Last edited: Mar 6, 2014
  21. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226
    Here are some notes which might help you.

    Situation #1.
    You want to use the builtin WWW class to fetch stuff from a HTTP server.

    In this case, you MUST have a crossdomain.xml file that is hosted by that SAME HTTP server,

    This will allow, and ONLY allow Unity's builtin WWW class to work. It has no effect on the usage of .NET sockets within Unity.

    This particular setup will NEVER help you get .NET sockets (and by extension UniWeb) working within Unity WebPlayer.


    Situation #2.
    You want to use UniWeb to fetch stuff from a HTTP server.

    In this case, you MUST have a server process running on a port on the SAME host, which follows the behaviour specified in the manual.

    This will allow .NET sockets (and therefore UniWeb) to work within a Unity WebPlayer. The Security.PrefetchSocketPolicy MUST be called before .NET sockets will successfully connect to a host on ANY port.

    Particularly note this section from the manual:
    ------------------------------------
    Specifically the server expects to receive a zero-terminated string
    that contains . It only sends to the client the socket policy xml document when this string (and exactly this string) has been received. Further, it is required that the xml header and xml body are sent with a single socket write.
    ------------------------------------
    Also note:

    ------------------------------------
    Note: Whilst the crossdomain.xml and socket policy files are both xml
    documents and are broadly similar, the way that these documents are served are very different. Crossdomain.xml (which applied to http requests) is fetched using http on port 80, where-as the socket policy is fetched from port 843 using a trivial server that implements the <policy-file-request/>. You cannot use an http server to issue the socket policy file, nor set up a server that simply sends the socket policy file in response to a socket connection on port 843. Note also that each server you connect to requires its own socket policy server.
    ------------------------------------
     
  22. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226
    I've not done that either. I've exposed the callback method for the brave!
     
  23. henkjan

    henkjan

    Joined:
    Aug 1, 2013
    Posts:
    131
    Hi Simon,

    I believe I use Situation 2. Do you mean that my web client has to run in the same domain as the Rest service?

    And can you explain this: 'Specifically the server expects to receive a zero-terminated string' a bit more because I don't understand what this is :(

    Last question: what are socket policy files? Do I have to add them to my rest api domain?

    Sorry for asking you all this :?
     
  24. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226
    No, you need the web server process and the policy server running on the same domain.
    This is a string terminated with a the C null byte character. Also know as a C string. This is what the sockpol.exe from Unity provides.
    Socket policy file is the crossdomain.xml file.
     
  25. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    219
    Hello,

    Small question, I am successfully using Uniweb with our api, but since I started using https i'm getting troubles. In editor mode all is fine, I can connect with our api server (different host). But when I run the code from the webplayer I get this exception:

    Code (csharp):
    1. Received no response for https://dev.api.kweetet.be/profile: System.IO.IOException: The authentication or decryption has failed. ---> System.InvalidCastException: Cannot cast from source type to destination type.
    2.   at System.Security.Cryptography.X509Certificates.X509Chain.GetSubjectKeyIdentifier (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) [0x00000] in <filename unknown>:0
    3.   at System.Security.Cryptography.X509Certificates.X509Chain.IsChainComplete (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) [0x00000] in <filename unknown>:0
    4.   at System.Security.Cryptography.X509Certificates.X509Chain.BuildChainFrom (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) [0x00000] in <filename unknown>:0
    5.   at System.Security.Cryptography.X509Certificates.X509Chain.Build (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) [0x00000] in <filename unknown>:0
    6.   at System.Net.Security.SslStream+<BeginAuthenticateAsClient>c__AnonStorey7.<>m__8 (System.Security.Cryptography.X509Certificates.X509Certificate cert, System.Int32[] certErrors) [0x00000] in <filename unknown>:0
    7.   at Mono.Security.Protocol.Tls.SslClientStream.OnRemoteCertificateValidation (System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Int32[] errors) [0x00000] in <filename unknown>:0
    8.   at Mono.Security.Protocol.Tls.SslStreamBase.RaiseRemoteCertificateValidation (System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Int32[] errors) [0x00000] in <filename unknown>:0
    9.   at Mono.Security.Protocol.Tls.SslClientStream.RaiseServerCertificateValidation (System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Int32[] certificateErrors) [0x00000] in <filename unknown>:0
    10.   at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in <filename unknown>:0
    11.   at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in <filename unknown>:0
    12.   at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in <filename unknown>:0
    13.   at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in <filename unknown>:0
    14.   at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
    15.   --- End of inner exception stack trace ---
    16.   at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
    Any idea what the cause can be? Or maybe a hint to search for a solution?

    In https://github.com/mono/mono/blob/m...ty.Cryptography.X509Certificates/X509Chain.cs

    I see that there is a dynamic cast, that fails according to the exception. Maybe this tips off an idea to the solution?

    Same problem was posted here: http://answers.unity3d.com/questions/499462/tcpclient-and-streams-in-webplayer-c.html?sort=oldest

    The class below reproduces the problem, in the editor you get an "Access Denied" in the console, but in the webplayer you get above exception in the log.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using System.Net;
    5.  
    6. public class HTTPSTest : MonoBehaviour {
    7.  
    8.     private IEnumerator Start () {
    9.         string url = "https://dev.api.kweetet.be/profile";
    10.         bool socketPolicyAvailable = Security.PrefetchSocketPolicy(GetIP ("dev.api.kweetet.be"), 443);
    11.         Debug.Log (string.Format("Socket policy is available: {0}", socketPolicyAvailable));
    12.  
    13.         HTTP.Request request = new HTTP.Request ("GET", url);
    14.         yield return request.Send();
    15.  
    16.         if(request.exception != null) {
    17.             Debug.LogError(request.exception.ToString());
    18.         }
    19.  
    20.         HTTP.Response response = request.response;
    21.        
    22.         if(response == null)
    23.         {
    24.             Debug.LogError(string.Format("Received no response for {0}: {1}", url, request.exception));
    25.         }
    26.         else if(response.status == 401)
    27.         {
    28.             Debug.LogError("Access denied: " + url);
    29.         }
    30.         else if(response.status == 503)
    31.         {
    32.             Debug.LogError("Server in maintenance: " + url);
    33.         }
    34.         else if(response.status == 404)
    35.         {
    36.             Debug.LogError("Unknown request: " + url);
    37.         }
    38.         else if(response.status == 500)
    39.         {
    40.             Debug.LogError("Internal server error: " + response.Text);
    41.         }
    42.     }
    43.  
    44.     private static string GetIP(string host)
    45.     {
    46.         return Dns.GetHostAddresses(host)[0].ToString();
    47.     }  
    48. }
    49.  
    Thanks,
    Alex
     
    Last edited: Mar 7, 2014
  26. Fragmental

    Fragmental

    Joined:
    Jun 30, 2013
    Posts:
    61
    I'm using uniweb to received a json. There is a variable coming from the json that flips flops between int and float depending on whether the value it contains does not have decimal. I think this is caused by a type "number" from the javascript based server. Is the parser that comes with uniweb capable of solving this problem? Do I need to use a different parser?

    Thank you for your time.
     
  27. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226
    Yes, I believe this will be handled. If you run into trouble with this let me know and I'll assist.
     
  28. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226
     
  29. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    219
    Mm, you're right. But it's likely that unity does not have the latest version, it changed from a static cast into a dynamic cast in august 2011: https://github.com/mono/mono/commit/5e2c0fbdb57619aa0cd926d65eb2613cd92f37d9
     
  30. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226
    Great news everybody! UniWeb now supports Charles, Fiddler, or any other proxy.

    You can force the global use of a proxy by setting:

    Code (csharp):
    1. HTTP.Request.proxy = new Uri("http://127.0.0.1:8888");
    This is available in version 2.1.8.
     
  31. Mike-B

    Mike-B

    Joined:
    Nov 18, 2012
    Posts:
    13
    Hi Simon,

    I am having issues with uniweb on iOS (my code works fin in the editor):

    Code (csharp):
    1. protected void DownloadAsyncIOS(string url)
    2.     {
    3.         Debug.LogWarning("DownloadAsyncIOS"+url);
    4.        
    5.         httpRequest = new Request("GET", url);
    6.        
    7.         UniWeb.Instance.Send(httpRequest, RequestCompleteDelegate);
    8.     }
    9.  
    10. public void RequestCompleteDelegate(Request request)
    11.     {
    12.         if(request.exception == null)
    13.         {
    14.             Debug.LogWarning("ios success "+request.response.status+" "+request.response.Bytes.LongLength);
    15.         }
    16.         else
    17.         {
    18.             Debug.LogWarning("ios failed "+request.exception.Message);
    19.         }
    20.     }
    The line 197 in HTTP.Request fails: pUri = System.Net.WebRequest.DefaultWebProxy.GetProxy(uri);
    and produces the error message "Object reference not set to an instance of an object". I checked and the uri is not null (and it only fails on the device).

    Any idea where the problem comes from?

    Thanks
     
    Last edited: Mar 17, 2014
  32. Ciprian

    Ciprian

    Joined:
    Jul 9, 2013
    Posts:
    27
    Ok, but how do you make a PUT or DELETE request and send some raw params to the server? Please provide an example. With my example, I can make a var r = new Request("PUT", "http://api", form); but by default uniweb doesn't support this
     
  33. Wtr

    Wtr

    Joined:
    Mar 20, 2014
    Posts:
    1
    We are experiencing the same problem. The DefaultWebProxy seems to result in a null reference on iOS. Anyone have a workaround for this? We've reverted to the previous version of UniWeb which does seem to work on iOS.

     
  34. Mike-B

    Mike-B

    Joined:
    Nov 18, 2012
    Posts:
    13
    Can I get the previous version of Uniweb in that case?
     
  35. Mike-B

    Mike-B

    Joined:
    Nov 18, 2012
    Posts:
    13
    I don't have the previous version, is there a way to put a hand on it?

    thx

    Guillaume
     
  36. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226
    This has now been fixed and is available on the asset store. Sorry for the delay.
     
  37. Ciprian

    Ciprian

    Joined:
    Jul 9, 2013
    Posts:
    27
    Hi.. is there any chance you can provide a PUT/DELETE example request?

    Params should be sent as raw json..

    Thanks
     
  38. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226
    Yes it does. Why does this not work for you? Do you have an error message?
     
  39. Mike-B

    Mike-B

    Joined:
    Nov 18, 2012
    Posts:
    13
    Awesome thank you.
     
  40. Mike-B

    Mike-B

    Joined:
    Nov 18, 2012
    Posts:
    13
    Hi Simon,

    I am using uniweb and it usually works fine. However I am getting an empty bytes array in the response from this url:

    http://www.ngdc.noaa.gov/geomag-web...?lat1=-36.8518&lon1=174.8554&resultFormat=xml

    my code is something like

    Code (csharp):
    1.  
    2. httpRequest = new Request(webProtocol, url);
    3. UniWeb.Instance.Send(httpRequest, RequestCompleteDelegate);
    I tried to set the Accept header to "*/*" or to "application/xml" but did not work... Any idea?
    Thx
     
    Last edited: Apr 1, 2014
  41. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,349
    Very cool plugin.

    Can UniWeb be used on the webplayer, desktop,mobile to send/receive data to/from Facebook, Twitter, and other social sites ?

    Cheers.
     
  42. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226
    Yes, absolutely. It will work with any HTTP service.
     
  43. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,349
    I checked your forum and someone mentioned that the webPlayer uses sockets and that facebook needs some sort of policy file which doesn't work. Please correct if wrong.
     
  44. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226
    Thanks for the bug report, this is now fixed in version 3.0B (please note this is a beta release!).
     
  45. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226
    UniWeb 3.0 beta is available.

    UniWeb has some work in progress WP8 support, expect issues with this, but we are very close!
     
  46. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,349
    Can you confirm whether Webplayer works with Facebook Graph API ?
     
  47. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226
    I very much doubt the webplayer will connect to Facebook, unless Facebook supports providing a crossdomain policy file over a network socket. I do not know if facebook provides this.
     
  48. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,349
    Last edited: Apr 4, 2014
  49. simonwittber

    simonwittber

    Joined:
    May 13, 2008
    Posts:
    226

    That is not a workaround to get sockets working in a web player, it is using the web browser javascript engine via externalcall to make web requests. It will not help you get sockets working in webplayer.

    OAuth services are just like any other HTTP service, the same rules apply.

    If want to use the builtin WWW class to fetch stuff from a HTTP server, you MUST have a crossdomain.xml file that is hosted by that SAME HTTP server, This will allow Unity's builtin WWW class to work. It has no effect on the usage of .NET sockets (and therefore UniWeb) within Unity Webplayer.

    If you want to use UniWeb to fetch stuff from a HTTP server you MUST have a server process running on a port on the SAME host, which follows the behaviour specified in the manual. This will allow .NET sockets (and therefore UniWeb) to work within a Unity WebPlayer. The Security.PrefetchSocketPolicy MUST be called before .NET sockets will successfully connect to a host on ANY port.

    more info here: http://entitycrisis.blogspot.com.au/2012/09/uniweb-www-and-crossdomainxml-explained.html
     
  50. MUXIAN

    MUXIAN

    Joined:
    Jan 15, 2013
    Posts:
    6
    Hi, I really need you help about this weird issues. The problem happens when I try to connect to Websocket server.

    When I am on MAC, everything works just fine but once I deploy the application to my iphone. I will only be able to connect to the Websocket server if I am using cellar data. Once I switch to the WIFI, it fails. What makes it even stranger is that, my server also receive no log from the device but once I force kill the application, server will see the request coming and connection established.

    I debugged for a while and find that the application blocks at a ReadByte function in side the response class.

    Do you have any idea what could be the problem and how can I solve it? Thank you very much.
     
unityunity