Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Proper way to program HTTP for html5/webgl?

Author
Message
Chmava
10
Years of Service
User Offline
Joined: 20th Jun 2013
Location:
Posted: 9th Dec 2018 07:07 Edited at: 9th Dec 2018 07:24
In a post, paul the developer claim that http work in html5.
The document did not claim that certain http command does not work in html5/webgl.

I have the following code:



It work great when running as an .exe with f5.
However, in http5/webgl, it return a -1 and a status code of 0.
Is there a special configuration to be made in the browser?
Or is there another way to actually program it for html5/webgl?

Any help appreciated!

If it does not work, I would have to use 2 app with one on the server using websocket.
However, websocket does not seems to have any form of ssl like protection?
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 10th Dec 2018 01:26
when running from html5, the game itself will likely be using port 80, this will prevent whatever you have responding to the http request on localhost from listening to that port.
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Chmava
10
Years of Service
User Offline
Joined: 20th Jun 2013
Location:
Posted: 10th Dec 2018 08:13 Edited at: 10th Dec 2018 08:19
Well, I tried it with https, port 443 and it is the same.
I tried SetHTTPHost (http, "website.com:999", 0) and it did not work when running in desktop. (.exe)
Also tried an actual website SetHTTPHost (http, "website.com", 1) and it did not work.

If it does not work, just put it in documentation that it does not work...

html5 is kind of useless if there is no feedback from a database source!
You can't even do highscore unless you are only expecting guest highscore...

High jack the javascript alert system to submit to server... what about the opposite?
Who care about 3D if AppGameKit core system and functionality is lacking/broken?
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 11th Dec 2018 21:43
It should work with port 80, although recent security developments have made cross domain access more restrictive which is most likely to be the issue here. The server you are trying to contact will need to allow access to the domain that your HTML5 is hosted on. You can read more here
Chmava
10
Years of Service
User Offline
Joined: 20th Jun 2013
Location:
Posted: 15th Dec 2018 13:40 Edited at: 15th Dec 2018 14:25
I think i figure out seomthing... wait a minute....
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 15th Dec 2018 14:17 Edited at: 15th Dec 2018 15:09
I don't have the reference handy, but I think there is an accept header needed for cors as well.

---

Here, I haven't tried cross origin requests with agk, but I have with a web server and a CEF application. I've got this on the server api request/response handler:

"Acess-Control-Allow-Origin", "*"

"Access-Control-Allow-Headers", "Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With"

"Access-Control-Allow-Methods", "GET, PUT, POST"

And my client requests include:

delete header: "X-Requested-With"
add header: "dataType", "jsonp"

here is the kicker though, that I'm not sure what the agk equivalent would be, or if agk even needs to configure anything similar:

the client uses an http library to send the request, it needs this line of configuration:

$httpProvider.defaults.useXDomain = true;
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Chmava
10
Years of Service
User Offline
Joined: 20th Jun 2013
Location:
Posted: 15th Dec 2018 14:38 Edited at: 15th Dec 2018 15:01
Erm... gethttpresponseready() is 1...
...But the gethttpstatuscode() return a 0 instead of 200....
The return data is fine after encoding and decoding?

Is this a bug?
The apps is program to read an ok status of 200.

UPDATE: It is working now that it is NOT checking for status code 200... what if it return a 404..? Did I actually found a bug? Did no one check for 200 and risk it?
Chmava
10
Years of Service
User Offline
Joined: 20th Jun 2013
Location:
Posted: 19th Dec 2018 04:56
Any update on this possible bug?
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 19th Dec 2018 19:32 Edited at: 19th Dec 2018 19:33
Seems silly to ask, but do you know that the server is actually sending a 200 code? That isn't necessarily automatic in the response header
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Chmava
10
Years of Service
User Offline
Joined: 20th Jun 2013
Location:
Posted: 20th Dec 2018 07:05
Are you saying the programming must be different between a pc, mobile and a html5 application?
That seems silly to me...?
The function gethttpstatuscode() does not serve its purpose?

Program once, deploy...
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 20th Dec 2018 13:07
No, I'm saying that the server application which is sending the response has to be verified as actually including a response code in its response header in order to troubleshoot if the code is being reported correctly by agk.
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Chmava
10
Years of Service
User Offline
Joined: 20th Jun 2013
Location:
Posted: 21st Dec 2018 06:35
I was going to post it, but apache log confirm sending out a header of 200.
I also check the error.log on top of the access.log.

No doubt it is a bug with the source of html5 agk as the linux and windows version of the apps actually pick up on the header 200 code.

Login to post a reply

Server time is: 2024-04-24 09:52:16
Your offset time is: 2024-04-24 09:52:16