Jump to content


Photo

GameMaker Websocket


  • Please log in to reply
118 replies to this topic

#41 lukeescude

lukeescude

    GMC Member

  • GMC Member
  • 514 posts
  • Version:GM:Studio

Posted 28 January 2012 - 09:59 PM

Ignore what I said earlier, I got it working... HTML5 game_id function returns 0 no matter what, it's a bug.


Is there a way for you to make the socket more efficient? Sometimes data will just build up, then the client will get a sudden burst of data spontaneously.
  • 0

#42 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 29 January 2012 - 01:08 AM

Oh I understood what you mean. If client is idle (browser tab inactive) and then turns active it will get "a sudden burst of data". I am not JS coder and cant understand what causes this. As I know JS code should run when browser tab is idle (inactive). If someone can explain me about this "bug" or give some links to read sure I fix this (this is major problem).

Edited by Demion, 29 January 2012 - 01:27 AM.

  • 0

#43 lukeescude

lukeescude

    GMC Member

  • GMC Member
  • 514 posts
  • Version:GM:Studio

Posted 29 January 2012 - 05:54 AM

Other than that issue (which has nothing to do with your extension), your extension is quite nice, and works as advertised.

I've been porting my GMechanism API over to HTML5 using GMWS, so far it's going really well.
  • 0

#44 lukeescude

lukeescude

    GMC Member

  • GMC Member
  • 514 posts
  • Version:GM:Studio

Posted 29 January 2012 - 04:23 PM

Since websockets are slow, I tried using this to prevent the game from starting while the socket was still connecting:

while(gmws_get_state(server)!=1)
{
//empty space
}

But my server shows the HTML5 game connecting over and over again
  • 0

#45 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 29 January 2012 - 09:04 PM

It shouldnt reconnect at all

function gmws_get_state(id)
{
if (!gmws_isWebsocket())
return -1;
return sockets[id].readyState;
}

What you mean by "websocket are slow"? I think websockets are fast enough. I ll make some tests with "a sudden burst of data" and get_state function. I want to figure out issue cause - GameMaker arhitecture or JS Html5.

Edited by Demion, 29 January 2012 - 09:04 PM.

  • 0

#46 lukeescude

lukeescude

    GMC Member

  • GMC Member
  • 514 posts
  • Version:GM:Studio

Posted 29 January 2012 - 11:44 PM

I meant slow in connecting - there's no way to tell exactly when it connects, I'm just having to set a 3 second timer between connection and gameplay.

It's all good though, I think I'm going to stick to PHP to communicate with my server.
  • 0

#47 oneSOB

oneSOB

    GMC Member

  • New Member
  • 33 posts

Posted 30 January 2012 - 07:00 PM

Sorry for delay. Ill release "translator" gmws sources next release (+Opera support). I was very busy last week. I hope Ill release it this weekends.


Its the end of Jan now what happen to GMWS translator source code? :confused:
  • 0

#48 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 04 February 2012 - 05:00 AM

gmws Sources
As promised. Gmws (websocket protocol) c/cpp sources. They are not finished, not commented, not organised. Ill post it in 1st post when organise code better.
  • 0

#49 oneSOB

oneSOB

    GMC Member

  • New Member
  • 33 posts

Posted 09 February 2012 - 07:17 PM

gmws Sources
As promised. Gmws (websocket protocol) c/cpp sources. They are not finished, not commented, not organised. Ill post it in 1st post when organise code better.


Y i thank you very much good MR :medieval:
I appreciate this very much
have a good day

Edited by oneSOB, 09 February 2012 - 07:18 PM.

  • 0

#50 iceshield

iceshield

    GMC Member

  • GMC Member
  • 393 posts

Posted 19 February 2012 - 04:36 PM

why this is not working in firefox? :rolleyes: (it blocks at loading)
awsome , i'll start building a game on this extension right away :)
  • 0

#51 Maxinston

Maxinston

    Epic Phail

  • GMC Member
  • 1230 posts
  • Version:Unknown

Posted 25 February 2012 - 03:04 PM

1 127.0.0.1:4967 127.0.0.1:8181 185 Recv
0000 47 45 54 20 2F 20 48 54 54 50 2F 31 2E 31 0D 0A GET / HTTP/1.1..
0010 55 70 67 72 61 64 65 3A 20 77 65 62 73 6F 63 6B Upgrade: websock
0020 65 74 0D 0A 43 6F 6E 6E 65 63 74 69 6F 6E 3A 20 et..Connection:
0030 55 70 67 72 61 64 65 0D 0A 48 6F 73 74 3A 20 31 Upgrade..Host: 1
0040 32 37 2E 30 2E 30 2E 31 3A 38 31 38 31 0D 0A 4F 27.0.0.1:8181..O
0050 72 69 67 69 6E 3A 20 68 74 74 70 3A 2F 2F 31 32 rigin: http://12
0060 37 2E 30 2E 30 2E 31 3A 35 31 32 36 38 0D 0A 53 7.0.0.1:51268..S
0070 65 63 2D 57 65 62 53 6F 63 6B 65 74 2D 4B 65 79 ec-WebSocket-Key
0080 3A 20 38 54 45 56 31 37 45 76 4E 54 47 6A 69 5A : 8TEV17EvNTGjiZ
0090 6B 51 68 6C 63 6E 42 77 3D 3D 0D 0A 53 65 63 2D kQhlcnBw==..Sec-
00A0 57 65 62 53 6F 63 6B 65 74 2D 56 65 72 73 69 6F WebSocket-Versio
00B0 6E 3A 20 31 33 0D 0A 0D 0A n: 13....

2 127.0.0.1:8181 127.0.0.1:4967 174 Send
0000 48 54 54 50 2F 31 2E 31 20 31 30 31 20 57 65 62 HTTP/1.1 101 Web
0010 20 53 6F 63 6B 65 74 20 50 72 6F 74 6F 63 6F 6C Socket Protocol
0020 20 48 61 6E 64 73 68 61 6B 65 0D 0A 55 70 67 72 Handshake..Upgr
0030 61 64 65 3A 20 57 65 62 53 6F 63 6B 65 74 0D 0A ade: WebSocket..
0040 43 6F 6E 6E 65 63 74 69 6F 6E 3A 20 55 70 67 72 Connection: Upgr
0050 61 64 65 0D 0A 57 65 62 53 6F 63 6B 65 74 2D 4F ade..WebSocket-O
0060 72 69 67 69 6E 3A 20 68 74 74 70 3A 2F 2F 6C 6F rigin: http://lo
0070 63 61 6C 68 6F 73 74 3A 38 30 38 30 0D 0A 57 65 calhost:8080..We
0080 62 53 6F 63 6B 65 74 2D 4C 6F 63 61 74 69 6F 6E bSocket-Location
0090 3A 20 77 73 3A 2F 2F 6C 6F 63 61 6C 68 6F 73 74 : ws://localhost
00A0 3A 38 31 38 31 2F 63 68 61 74 0D 0A 0D 0A :8181/chat....

GET / HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: 127.0.0.1:8181
Origin: http://127.0.0.1:51268
Sec-WebSocket-Key: 8TEV17EvNTGjiZkQhlcnBw==
Sec-WebSocket-Version: 13

HTTP/1.1 101 WebSocket Protocol Handshake
Upgrade: WebSocket
Connection: Upgrade
WebSocket-Origin: http://localhost:8080
WebSocket-Location: ws://localhost:8181/chat

I am trying to make my C# server accept the handshake, it seems that the server accepts the clients handshake but the client doesn't accept the server so the player exit event fires off in the server instantly after connection. Help appreciated.
  • 0

#52 Maxinston

Maxinston

    Epic Phail

  • GMC Member
  • 1230 posts
  • Version:Unknown

Posted 26 February 2012 - 12:48 PM

EDIT: NVM got it using teh source thx everyone :D

Edited by pepolshet, 26 February 2012 - 01:04 PM.

  • 0

#53 Maxinston

Maxinston

    Epic Phail

  • GMC Member
  • 1230 posts
  • Version:Unknown

Posted 02 March 2012 - 01:10 PM

This doesn't seem to work neither in my programs or the example :turned:

send [-1] = {15}

Edited by pepolshet, 02 March 2012 - 01:13 PM.

  • 0

#54 Maxinston

Maxinston

    Epic Phail

  • GMC Member
  • 1230 posts
  • Version:Unknown

Posted 09 March 2012 - 05:36 PM

This doesn't seem to work neither in my programs or the example :turned:

send [-1] = {15}


It seems that it takes 20-60 seconds for the first packets to arrive but since then every is flawless, does anyone else experience this?
  • 0

#55 thedyingdragon

thedyingdragon

    GMC Member

  • GMC Member
  • 23 posts

Posted 09 March 2012 - 05:47 PM

It seems that it takes 20-60 seconds for the first packets to arrive but since then every is flawless, does anyone else experience this?


I don't have this issue
Im using a C++ server and I test on my local machine and a remote machine(which is my actual server)
Both times it connects fine and recieves packets right away
  • 0

#56 Maxinston

Maxinston

    Epic Phail

  • GMC Member
  • 1230 posts
  • Version:Unknown

Posted 09 March 2012 - 07:24 PM


It seems that it takes 20-60 seconds for the first packets to arrive but since then every is flawless, does anyone else experience this?


I don't have this issue
Im using a C++ server and I test on my local machine and a remote machine(which is my actual server)
Both times it connects fine and recieves packets right away


It's kind of weird come to think of it, when I connect to my server a new player is created instantaneously yet when I try to send bytes it takes up to a minute for the first ones to arrive. If I disconnect the client in the middle and close the socket the server receives the bytes before the sixty second period.
  • 0

#57 Maxinston

Maxinston

    Epic Phail

  • GMC Member
  • 1230 posts
  • Version:Unknown

Posted 11 March 2012 - 02:16 PM


It seems that it takes 20-60 seconds for the first packets to arrive but since then every is flawless, does anyone else experience this?


I don't have this issue
Im using a C++ server and I test on my local machine and a remote machine(which is my actual server)
Both times it connects fine and recieves packets right away


After some testing I can see that GMWS never receives the bytes from the HTML5 app, they never even leave it.

Help appreciated
  • 0

#58 Manuel777

Manuel777

    InvaderGames

  • GMC Member
  • 2864 posts
  • Version:GM:Studio

Posted 19 March 2012 - 09:08 PM

Wicked, tagged for later :)
  • 0

#59 Debels

Debels

    GMC Member

  • GMC Member
  • 1997 posts
  • Version:GM:Studio

Posted 19 March 2012 - 09:54 PM

Finally found a use for this extension :)

Coming Soon The Gaming Central!

If you don't know what a Gaming Central is click spoiler:

Spoiler

  • 0

#60 Crhonos

Crhonos

    GMC Member

  • GMC Member
  • 219 posts
  • Version:GM:Studio

Posted 25 April 2012 - 09:22 PM

Is Demion still working in this project ?

Did anyone get this to work?

I am trying to make it work, but heres the thing, i have a 39dll c++ server running, that accepts normally gm8.1 clients(with 39dll) but when i try to use GMWS "translator" and gmws.gex i can't get things to work properly, my server receives the message of incoming client, but hte client does not receive the server answer.

Do i have to change my 39dll server so it will be compatible with gmws or i just have to get gmws translator working fine ?

--- Also i can't compile gmws source, i get an error saying that SHA1 get in the end of the line.--Got it compiled.

Help would be apreciated =D

Edited by Crhonos, 30 April 2012 - 12:29 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users