• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

HTML5 Web sockets | Not getting a connection

N

Nexust

Guest
Hi all!
I'm working on a little project. It's a simple client/server situation. While using TCP, the client connects to the server without issue. After changing both the server and client to use WebSockets, I can't get a connection.
The server is currently running straight from the VM on Mac, the client is running as HTML5. The only change in code between was
GML:
network_socket_tcp
to
GML:
network_socket_ws
in both the client and server.
Can anyone think of anything that could steer me in the right direction?
 
It's not a trivial swap-and-go.
Well, that's debatable... Just depends on the person who's doing the swapping. For me personally? It'd be an an uphill battle both ways in the show... but other folk may consider it trivial. If you've never worked with websockets before this link links to some other links which should help get you started.
 
Last edited:

FrostyCat

Redemption Seeker
Well, that's debatable... Just depends on the person who's doing the swapping. For me personally? It'd be an an uphill battle both ways in the show... but other folk may consider it trivial. If you've never worked with websockets before this link links to some other links which should help get you started.
I have worked with WebSockets before, in fact I wrote an extension for HTML5 WebSockets before YoYo even started building it into the engine. So I know what I'm talking about.

The "trivial swap-and-go" I'm referring to is this:
The only change in code between was
GML:
network_socket_tcp
to
GML:
network_socket_ws
in both the client and server.
If the original poster is building the server on the HTML5 export as well, this is the part that won't work because the export produces client-side JS. You can only make outgoing connections on client-side JS, you can't receive incoming connections.
 
I have worked with WebSockets before, in fact I wrote an extension for HTML5 WebSockets before YoYo even started building it into the engine. So I know what I'm talking about.
I never doubted that for a second. The last sentence in my post was intended for OP. I believe that you misunderstood my meaning, and that I should have made that comment in a seperate paragraph.
If the original poster is building the server on the HTML5 export as well, this is the part that won't work because the export produces client-side JS. You can only make outgoing connections on client-side JS, you can't receive incoming connections.
Believe it or not, I did know that. :D

PS: Sorry for splitting hairs in the first place. That's unnecessary.
 
Last edited:
N

Nexust

Guest
It's not a trivial swap-and-go.
Ah, it seemed too good to be true. I was lead to believe it really was a "trivial swap-and-go".

If the original poster is building the server on the HTML5 export as well, this is the part that won't work because the export produces client-side JS. You can only make outgoing connections on client-side JS, you can't receive incoming connections.
The server is being built for the MacOS target. The client is HTML5. I'm sure I don't have to say it but my networking knowledge is minimal; I'm aware that developing my server in GM isn't the best approach but I'm only having a bit of fun and learning along the way- would I be right in thinking I cannot use GM at all to develop the server if I want the client to be HTML5? Or should my server be TCP?

For clarification, I only want the client to be HTML5. The client will be a windows export, more than likely running on a VPS.
 

FrostyCat

Redemption Seeker
Ah, it seemed too good to be true. I was lead to believe it really was a "trivial swap-and-go".


The server is being built for the MacOS target. The client is HTML5. I'm sure I don't have to say it but my networking knowledge is minimal; I'm aware that developing my server in GM isn't the best approach but I'm only having a bit of fun and learning along the way- would I be right in thinking I cannot use GM at all to develop the server if I want the client to be HTML5? Or should my server be TCP?

For clarification, I only want the client to be HTML5. The client will be a windows export, more than likely running on a VPS.
Binaries generated by GMS 2 require a 3D-accelerated graphics, which most VPSs come without. This is the big problem that people trying to make central servers in GM don't realize, and in the end they can only run off home machines. And client-side JS cannot do raw TCP at all, so making the server work on that is out of the question to start with if the client is to be in HTML5.

There are unofficial accounts of being able to run GMS 2 binaries in a server environment (example), but they require special setup and carry no warranty from anyone.
 
Top