doesn't work on Unity Web player. #1

Closed
opened 2012-03-22 23:18:04 -07:00 by thetnswe · 16 comments
thetnswe commented 2012-03-22 23:18:04 -07:00 (Migrated from github.com)

Hey,
I looked at ur code and it looks really nice and working perfectly in Unity Stanalone applicaiton. When I try to call from Webplayer environment, request always return null even inside editor. Can someone give me example working code for Unity webplayer?

Hey, I looked at ur code and it looks really nice and working perfectly in Unity Stanalone applicaiton. When I try to call from Webplayer environment, request always return null even inside editor. Can someone give me example working code for Unity webplayer?
andyburke commented 2012-03-23 19:34:11 -07:00 (Migrated from github.com)

Can you give me some more information? Can you show some of the code or create a small sample project that I could try out?

Can you give me some more information? Can you show some of the code or create a small sample project that I could try out?
thetnswe commented 2012-03-23 20:41:26 -07:00 (Migrated from github.com)

Hi,
Thanks for the reply.. Attached file is the test project I created. I
already put a test url link so you can actually try calling to this url. It
prefectly works on Unity standalone but when you switch this one to the
Unity webplayer, request becomes null.. I really appreciate for your help.

On Sat, Mar 24, 2012 at 10:34 AM, Andy Burke <
reply@reply.github.com

wrote:

Can you give me some more information? Can you show some of the code or
create a small sample project that I could try out?


Reply to this email directly or view it on GitHub:
https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4671145

Thet Naing Swe
Co-Founder & Chief Creative Director
HP: 81137017
Twitter: @thetnswe

Company info:
URL: http://rivaledge.sg http://rivaledge.sgTwitter
Twitter
http://rivaledge.sgTwitter
@RivalEdgeSG
Fan page: http://www.facebook.com/rivaledge
Hi, Thanks for the reply.. Attached file is the test project I created. I already put a test url link so you can actually try calling to this url. It prefectly works on Unity standalone but when you switch this one to the Unity webplayer, request becomes null.. I really appreciate for your help. On Sat, Mar 24, 2012 at 10:34 AM, Andy Burke < reply@reply.github.com > wrote: > > Can you give me some more information? Can you show some of the code or > create a small sample project that I could try out? > > --- > > Reply to this email directly or view it on GitHub: > https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4671145 ## Thet Naing Swe Co-Founder & Chief Creative Director HP: 81137017 Twitter: @thetnswe Company info: URL: http://rivaledge.sg http://rivaledge.sgTwitter Twitter http://rivaledge.sgTwitter : @RivalEdgeSG Fan page: http://www.facebook.com/rivaledge
andyburke commented 2012-03-26 16:36:53 -07:00 (Migrated from github.com)

Unfortunately, github doesn't allow attachments. You'll need to put your file somewhere (in Dropbox, or on a site).

This may be related to 'socket policy' for the web client. For instance, I believe when I was testing the web player stuff with the HTTP client, I had to have a 'socket policy server' running. Here's a trivial example that will work with node.js, but there are others around as well:

var net = require("net");

var policy = '\
    <cross-domain-policy>\
        <allow-access-from domain="*" to-ports="*" />\
    </cross-domain-policy>\
';

var socketPolicyServer = net.createServer( function ( stream ) {
    stream.setTimeout( 0 );
    stream.setEncoding( "utf8" );

    stream.addListener( "connect", function () {   
    });

    stream.addListener( "data", function ( data ) {
        if ( data.indexOf( '<policy-file-request/>' ) != -1 )
        {
            stream.write( policy );
        } 
        stream.end();
    });

    stream.addListener( "end", function() {
        stream.end();
    });
});

socketPolicyServer.listen( 843 );
Unfortunately, github doesn't allow attachments. You'll need to put your file somewhere (in Dropbox, or on a site). This may be related to 'socket policy' for the web client. For instance, I believe when I was testing the web player stuff with the HTTP client, I had to have a 'socket policy server' running. Here's a trivial example that will work with node.js, but there are others around as well: ``` javascript var net = require("net"); var policy = '\ <cross-domain-policy>\ <allow-access-from domain="*" to-ports="*" />\ </cross-domain-policy>\ '; var socketPolicyServer = net.createServer( function ( stream ) { stream.setTimeout( 0 ); stream.setEncoding( "utf8" ); stream.addListener( "connect", function () { }); stream.addListener( "data", function ( data ) { if ( data.indexOf( '<policy-file-request/>' ) != -1 ) { stream.write( policy ); } stream.end(); }); stream.addListener( "end", function() { stream.end(); }); }); socketPolicyServer.listen( 843 ); ```
thetnswe commented 2012-03-26 18:22:47 -07:00 (Migrated from github.com)

Hi Andy,
I didn't know that Github doesn't accept attachments.. :) I put the file
into the http://dl.dropbox.com/u/8302740/HTTPWebplayerTest.rar ..If it's
a socket policy, I don't understand why it does work when I tried calling
with normal WWWForm.. I am totally noob to the web..

Thet

On Tue, Mar 27, 2012 at 7:36 AM, Andy Burke <
reply@reply.github.com

wrote:

Unfortunately, github doesn't allow attachments. You'll need to put your
file somewhere (in Dropbox, or on a site).

This may be related to 'socket policy' for the web client. For instance,
I believe when I was testing the web player stuff with the HTTP client, I
had to have a 'socket policy server' running. Here's a trivial example
that will work with node.js, but there are others around as well:

var net = require("net");

var policy = '\
   <cross-domain-policy>\
       <allow-access-from domain="*" to-ports="*" />\
   </cross-domain-policy>\
';

var socketPolicyServer = net.createServer( function ( stream ) {
   stream.setTimeout( 0 );
   stream.setEncoding( "utf8" );

   stream.addListener( "connect", function () {
   });

   stream.addListener( "data", function ( data ) {
       if ( data.indexOf( '<policy-file-request/>' ) != -1 )
       {
           stream.write( policy );
       }
       stream.end();
   });

   stream.addListener( "end", function() {
       stream.end();
   });
});

socketPolicyServer.listen( 843 );

Reply to this email directly or view it on GitHub:
https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4706849

Hi Andy, I didn't know that Github doesn't accept attachments.. :) I put the file into the http://dl.dropbox.com/u/8302740/HTTPWebplayerTest.rar ..If it's a socket policy, I don't understand why it does work when I tried calling with normal WWWForm.. I am totally noob to the web.. Thet On Tue, Mar 27, 2012 at 7:36 AM, Andy Burke < reply@reply.github.com > wrote: > > Unfortunately, github doesn't allow attachments. You'll need to put your > file somewhere (in Dropbox, or on a site). > > This may be related to 'socket policy' for the web client. For instance, > I believe when I was testing the web player stuff with the HTTP client, I > had to have a 'socket policy server' running. Here's a trivial example > that will work with node.js, but there are others around as well: > > ``` javascript > var net = require("net"); > > var policy = '\ > <cross-domain-policy>\ > <allow-access-from domain="*" to-ports="*" />\ > </cross-domain-policy>\ > '; > > var socketPolicyServer = net.createServer( function ( stream ) { > stream.setTimeout( 0 ); > stream.setEncoding( "utf8" ); > > stream.addListener( "connect", function () { > }); > > stream.addListener( "data", function ( data ) { > if ( data.indexOf( '<policy-file-request/>' ) != -1 ) > { > stream.write( policy ); > } > stream.end(); > }); > > stream.addListener( "end", function() { > stream.end(); > }); > }); > > socketPolicyServer.listen( 843 ); > ``` > > --- > > Reply to this email directly or view it on GitHub: > https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4706849
andyburke commented 2012-03-26 19:14:43 -07:00 (Migrated from github.com)

Thanks for adding a link to the attachment. I will try to take a look when I get a chance.

I believe that the difference is that this HTTP library opens direct sockets, and Unity is set up to require a policy when doing that from the web player. They allow it when using the WWW object, but not when opening a bare socket.

I think the next best step for you to take would be to either:

  1. run the socket policy server I posted above using node, or
  2. google for 'socket policy server (your language of choice)'

If you're running a socket policy server on the same server your unity webclient is being served from and the HTTP plugin still doesn't work, then there's likely a bug. If it does start working, then the policy server is a definite requirement and I'll add that to the documentation.

Otherwise, when I get a chance I will test this out, but I'm very busy for the next month or two at the least on a contract, so I may not be able to test this all that quickly.

Thanks for adding a link to the attachment. I will try to take a look when I get a chance. I believe that the difference is that this HTTP library opens direct sockets, and Unity is set up to require a policy when doing that from the web player. They allow it when using the WWW object, but not when opening a bare socket. I think the next best step for you to take would be to either: 1) run the socket policy server I posted above using node, or 2) google for 'socket policy server (your language of choice)' If you're running a socket policy server on the same server your unity webclient is being served from and the HTTP plugin still doesn't work, then there's likely a bug. If it _does_ start working, then the policy server is a definite requirement and I'll add that to the documentation. Otherwise, when I get a chance I will test this out, but I'm very busy for the next month or two at the least on a contract, so I may not be able to test this all that quickly.
thetnswe commented 2012-03-26 19:26:51 -07:00 (Migrated from github.com)

Thanks Andy,
I will try and test this policy thing and will give you the result that
it works or not.. I am currently in the need of this working for webplayer
so I will have to try hard fixing on it.. Thanks alot for ur help.

On Tue, Mar 27, 2012 at 10:14 AM, Andy Burke <
reply@reply.github.com

wrote:

Thanks for adding a link to the attachment. I will try to take a look
when I get a chance.

I believe that the difference is that this HTTP library opens direct
sockets, and Unity is set up to require a policy when doing that from the
web player. They allow it when using the WWW object, but not when opening
a bare socket.

I think the next best step for you to take would be to either:

  1. run the socket policy server I posted above using node, or
  2. google for 'socket policy server '

If you're running a socket policy server on the same server your unity
webclient is being served from and the HTTP plugin still doesn't work, then
there's likely a bug. If it does start working, then the policy server
is a definite requirement and I'll add that to the documentation.

Otherwise, when I get a chance I will test this out, but I'm very busy for
the next month or two at the least on a contract, so I may not be able to
test this all that quickly.


Reply to this email directly or view it on GitHub:
https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4708488

Thanks Andy, I will try and test this policy thing and will give you the result that it works or not.. I am currently in the need of this working for webplayer so I will have to try hard fixing on it.. Thanks alot for ur help. On Tue, Mar 27, 2012 at 10:14 AM, Andy Burke < reply@reply.github.com > wrote: > > Thanks for adding a link to the attachment. I will try to take a look > when I get a chance. > > I believe that the difference is that this HTTP library opens direct > sockets, and Unity is set up to require a policy when doing that from the > web player. They allow it when using the WWW object, but not when opening > a bare socket. > > I think the next best step for you to take would be to either: > > 1) run the socket policy server I posted above using node, or > 2) google for 'socket policy server <your language of choice>' > > If you're running a socket policy server on the same server your unity > webclient is being served from and the HTTP plugin still doesn't work, then > there's likely a bug. If it _does_ start working, then the policy server > is a definite requirement and I'll add that to the documentation. > > Otherwise, when I get a chance I will test this out, but I'm very busy for > the next month or two at the least on a contract, so I may not be able to > test this all that quickly. > > --- > > Reply to this email directly or view it on GitHub: > https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4708488
andyburke commented 2012-03-28 04:55:36 -07:00 (Migrated from github.com)

Any luck?

Any luck?
thetnswe commented 2012-03-28 05:18:03 -07:00 (Migrated from github.com)

No.. I am waiting for my server engineer to add the port policy to the
server.. I will let you know if it works or not.. :)

On Wed, Mar 28, 2012 at 7:55 PM, Andy Burke <
reply@reply.github.com

wrote:

Any luck?


Reply to this email directly or view it on GitHub:
https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4757408

Thet Naing Swe
Co-Founder & Chief Creative Director
HP: 81137017
Twitter: @thetnswe

Company info:
URL: http://rivaledge.sg http://rivaledge.sgTwitter
Twitter
http://rivaledge.sgTwitter
@RivalEdgeSG
Fan page: http://www.facebook.com/rivaledge
No.. I am waiting for my server engineer to add the port policy to the server.. I will let you know if it works or not.. :) On Wed, Mar 28, 2012 at 7:55 PM, Andy Burke < reply@reply.github.com > wrote: > > Any luck? > > --- > > Reply to this email directly or view it on GitHub: > https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4757408 ## Thet Naing Swe Co-Founder & Chief Creative Director HP: 81137017 Twitter: @thetnswe Company info: URL: http://rivaledge.sg http://rivaledge.sgTwitter Twitter http://rivaledge.sgTwitter : @RivalEdgeSG Fan page: http://www.facebook.com/rivaledge
andyburke commented 2012-03-28 12:39:32 -07:00 (Migrated from github.com)

Thanks, interested to know how this works out and want to fix the issue if it turns out that it's not just the socket policy.

Thanks, interested to know how this works out and want to fix the issue if it turns out that it's not just the socket policy.
thetnswe commented 2012-03-30 00:05:10 -07:00 (Migrated from github.com)

My Server engineer just came back and we tried to put the socket policy
into our server but it just does't work... I doubt that the TCPClient
doesn't even looked at the Crossdomainpolicy at all and Unity just reject
it.. :(

On Thu, Mar 29, 2012 at 3:39 AM, Andy Burke <
reply@reply.github.com

wrote:

Thanks, interested to know how this works out and want to fix the issue if
it turns out that it's not just the socket policy.


Reply to this email directly or view it on GitHub:
https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4782727

Thet Naing Swe
Co-Founder & Chief Creative Director
HP: 81137017
Twitter: @thetnswe

Company info:
URL: http://rivaledge.sg http://rivaledge.sgTwitter
Twitter
http://rivaledge.sgTwitter
@RivalEdgeSG
Fan page: http://www.facebook.com/rivaledge
My Server engineer just came back and we tried to put the socket policy into our server but it just does't work... I doubt that the TCPClient doesn't even looked at the Crossdomainpolicy at all and Unity just reject it.. :( On Thu, Mar 29, 2012 at 3:39 AM, Andy Burke < reply@reply.github.com > wrote: > > Thanks, interested to know how this works out and want to fix the issue if > it turns out that it's not just the socket policy. > > --- > > Reply to this email directly or view it on GitHub: > https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4782727 ## Thet Naing Swe Co-Founder & Chief Creative Director HP: 81137017 Twitter: @thetnswe Company info: URL: http://rivaledge.sg http://rivaledge.sgTwitter Twitter http://rivaledge.sgTwitter : @RivalEdgeSG Fan page: http://www.facebook.com/rivaledge
andyburke commented 2012-03-30 00:24:56 -07:00 (Migrated from github.com)

Ok. I'll try to take a look as soon as I get some free time.

Sent from my iPad

On Mar 30, 2012, at 12:05 AM, thetnswereply@reply.github.com wrote:

My Server engineer just came back and we tried to put the socket policy
into our server but it just does't work... I doubt that the TCPClient
doesn't even looked at the Crossdomainpolicy at all and Unity just reject
it.. :(

On Thu, Mar 29, 2012 at 3:39 AM, Andy Burke <
reply@reply.github.com

wrote:

Thanks, interested to know how this works out and want to fix the issue if
it turns out that it's not just the socket policy.


Reply to this email directly or view it on GitHub:
https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4782727

Thet Naing Swe
Co-Founder & Chief Creative Director
HP: 81137017
Twitter: @thetnswe

Company info:
URL: http://rivaledge.sg http://rivaledge.sgTwitter
Twitter
http://rivaledge.sgTwitter
@RivalEdgeSG
Fan page: http://www.facebook.com/rivaledge

Reply to this email directly or view it on GitHub:
https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4837394

Ok. I'll try to take a look as soon as I get some free time. Sent from my iPad On Mar 30, 2012, at 12:05 AM, thetnswereply@reply.github.com wrote: > My Server engineer just came back and we tried to put the socket policy > into our server but it just does't work... I doubt that the TCPClient > doesn't even looked at the Crossdomainpolicy at all and Unity just reject > it.. :( > > On Thu, Mar 29, 2012 at 3:39 AM, Andy Burke < > reply@reply.github.com > > > wrote: > > > > Thanks, interested to know how this works out and want to fix the issue if > > it turns out that it's not just the socket policy. > > > > --- > > > > Reply to this email directly or view it on GitHub: > > https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4782727 > > ## > > Thet Naing Swe > Co-Founder & Chief Creative Director > HP: 81137017 > Twitter: @thetnswe > > Company info: > URL: http://rivaledge.sg http://rivaledge.sgTwitter > Twitter > http://rivaledge.sgTwitter > : @RivalEdgeSG > Fan page: http://www.facebook.com/rivaledge > > --- > > Reply to this email directly or view it on GitHub: > https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4837394
thetnswe commented 2012-03-30 00:39:40 -07:00 (Migrated from github.com)

Cool.. That would be really useful.. :) I have no experience at all with C#
TCPClient

On Fri, Mar 30, 2012 at 3:24 PM, Andy Burke <
reply@reply.github.com

wrote:

Ok. I'll try to take a look as soon as I get some free time.

Sent from my iPad

On Mar 30, 2012, at 12:05 AM, thetnswereply@reply.github.com wrote:

My Server engineer just came back and we tried to put the socket policy
into our server but it just does't work... I doubt that the TCPClient
doesn't even looked at the Crossdomainpolicy at all and Unity just reject
it.. :(

On Thu, Mar 29, 2012 at 3:39 AM, Andy Burke <
reply@reply.github.com

wrote:

Thanks, interested to know how this works out and want to fix the issue
if
it turns out that it's not just the socket policy.


Reply to this email directly or view it on GitHub:
https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4782727

Thet Naing Swe
Co-Founder & Chief Creative Director
HP: 81137017
Twitter: @thetnswe

Company info:
URL: http://rivaledge.sg http://rivaledge.sgTwitter
Twitter
http://rivaledge.sgTwitter
@RivalEdgeSG
Fan page: http://www.facebook.com/rivaledge

Reply to this email directly or view it on GitHub:
https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4837394


Reply to this email directly or view it on GitHub:
https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4837634

Thet Naing Swe
Co-Founder & Chief Creative Director
HP: 81137017
Twitter: @thetnswe

Company info:
URL: http://rivaledge.sg http://rivaledge.sgTwitter
Twitter
http://rivaledge.sgTwitter
@RivalEdgeSG
Fan page: http://www.facebook.com/rivaledge
Cool.. That would be really useful.. :) I have no experience at all with C# TCPClient On Fri, Mar 30, 2012 at 3:24 PM, Andy Burke < reply@reply.github.com > wrote: > > Ok. I'll try to take a look as soon as I get some free time. > > Sent from my iPad > > On Mar 30, 2012, at 12:05 AM, thetnswereply@reply.github.com wrote: > > > My Server engineer just came back and we tried to put the socket policy > > into our server but it just does't work... I doubt that the TCPClient > > doesn't even looked at the Crossdomainpolicy at all and Unity just reject > > it.. :( > > > > On Thu, Mar 29, 2012 at 3:39 AM, Andy Burke < > > reply@reply.github.com > > > > > wrote: > > > > > > Thanks, interested to know how this works out and want to fix the issue > > > if > > > it turns out that it's not just the socket policy. > > > > > > --- > > > > > > Reply to this email directly or view it on GitHub: > > > https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4782727 > > > > ## > > > > Thet Naing Swe > > Co-Founder & Chief Creative Director > > HP: 81137017 > > Twitter: @thetnswe > > > > Company info: > > URL: http://rivaledge.sg http://rivaledge.sgTwitter > > Twitter > > http://rivaledge.sgTwitter > > : @RivalEdgeSG > > Fan page: http://www.facebook.com/rivaledge > > > > --- > > > > Reply to this email directly or view it on GitHub: > > https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4837394 > > --- > > Reply to this email directly or view it on GitHub: > https://github.com/andyburke/UnityHTTP/issues/1#issuecomment-4837634 ## Thet Naing Swe Co-Founder & Chief Creative Director HP: 81137017 Twitter: @thetnswe Company info: URL: http://rivaledge.sg http://rivaledge.sgTwitter Twitter http://rivaledge.sgTwitter : @RivalEdgeSG Fan page: http://www.facebook.com/rivaledge
hboylan commented 2014-09-19 07:31:37 -07:00 (Migrated from github.com)

@andyburke I just came across the same issue building for Web Player. Hosted the NodeJS server on the domain and now instead of saying "Unable to connect, as no valid crossdomain policy was found", it simply says "Connection refused". Thoughts, suggestions?

@andyburke I just came across the same issue building for Web Player. Hosted the NodeJS server on the domain and now instead of saying "Unable to connect, as no valid crossdomain policy was found", it simply says "Connection refused". Thoughts, suggestions?
andyburke commented 2014-09-19 12:34:37 -07:00 (Migrated from github.com)

@hboylan Hmm. Can you see the connection attempt on the server?

@hboylan Hmm. Can you see the connection attempt on the server?
hboylan commented 2014-09-19 13:30:11 -07:00 (Migrated from github.com)

It must be reaching the crossdomain.xml via the TCP server on port 843 since the error message changed, but it still doesn't reach my HTTP server on port 8080

It must be reaching the crossdomain.xml via the TCP server on port 843 since the error message changed, but it still doesn't reach my HTTP server on port 8080
andyburke commented 2014-09-22 17:25:21 -07:00 (Migrated from github.com)

Could you show the url you're using? Are you sure it's trying to connect on 8080? Does your policy server allow connections on 8080?

Could you show the url you're using? Are you sure it's trying to connect on 8080? Does your policy server allow connections on 8080?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
andyburke/UnityHTTP#1
No description provided.