Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In-Game: network_socket_tcp() sockets have unwanted extra packets returned after upgrading manually to Socket.io websockets #8635

Closed
2 tasks done
peardox opened this issue Dec 7, 2024 · 2 comments
Labels
gmrt-bug In-game bugs with the "GMRT" runtimes

Comments

@peardox
Copy link

peardox commented Dec 7, 2024

Description

Further to Forums...

If an async tcp socket is created and then later upgraded to a websocket - note - not using network_socket_ws(s) Gakemaker will send it's own Websocket continuation frames without the developer asking for it. While this may be acceptable and expected for network_socket_ws it should not occur when the socket is opened as network_socket_tcp then manually upgraded.

The effect of these automatically generated packets is to break some non-Gamemaker specific WS protocols. Of particular note is the widely used socket.io Node package. If handling the communications in code there is a very specific handshake protocol required by socket.io that is broken by Gamemaker's own continuation packets

Expected Change

Do not send any data unless socket is network_socket_ws/s

Steps To Reproduce

As this requires a functioning socket.io server I've got one running on http://piserv.co.uk. You can open this in a web browser and view interaction with the application below which also uses the same socket.io app (which is just an example from the socket.io repo)
Next you'll need WireShark to monitor the socket connection.
==== Website ====

  1. Open http://piserv.co.uk
  2. Choose a username and enter it (it's just a test so anything will do)
  3. Type some stuff and it will echo on the page

==== WireShark ====

  1. Start Wireshark
  2. Select Ethernet and/or Wifi
  3. Enter "host piserv.co.uk" in the text entry area and press enter

==== Gamemaker ====

  1. git clone https://github.com/peardox/GMEXT-SocketIO
  2. build and run GMEXT-SocketIO
  3. Click the button marked Add User (the user is called Gamemaker)
  4. Click the button marked Hello World
  5. Note that your web browser has just listed the new added user and the Hello World message from (3) + (4)
  6. Click the Upgrade button - anything you do past this point will cause GM to throw a Runtime Error (not caught the errors past here)

Now refer to WireShark
You will notice that the WebBrowser connects clean with the 101 upgrade followed by a running websocket with only the traffic between the browser and site showing.
HOWEVER - inspect the GameMaker 101 upgrade and you will see it is not clean with the upgrade being followed by a 2probe message from GM (I sent it) then an unwanted Websocket Continuation Frame - the websocket is marked as [Fragmented]. After this the website will immediately close the socket as the Continuation Frame breaks the socket.io protocol.
A little later you'll see me responding to a 3probe with a 5 (the 5 is the EngineIO Upgrade opcode) - however the websocket has already been closed because GM sent it's own Continuation Frame (I never do it...)

It may help to examine each session running by itself - run once only via web and a second time only via GM

Here's a sample from Wireshark

Image

The 2probe is part of the handshake which GM breaks by adding a Continuation Frame

Owing to tracking this problem there are numerous show_debug_message() calls that show what's going on under the hood

The websocket connection is valid so if GM doesn't send it's Continuation Frame the protocol will complete successfully (then break later as more Frames will be needed once past this step). If the websocket connects properly then this issue is resolved (and further issues are my fault from not being able to get past this point)

How reliably can you recreate this issue using your steps above?

Always

Which version of GMRT are you reporting this issue for?

2024.8.1.218

Contact Us Package Attached?

  • I have attached my Contact Us Package

Sample Project Added?

  • I have included a small sample project
@peardox peardox added the gmrt-bug In-game bugs with the "GMRT" runtimes label Dec 7, 2024
@peardox
Copy link
Author

peardox commented Dec 7, 2024

Oops - my fault - forget this

@peardox peardox closed this as completed Dec 7, 2024
@github-project-automation github-project-automation bot moved this from Triage to Done in Team Workload Dec 7, 2024
@gurpreetsinghmatharoo gurpreetsinghmatharoo moved this from Done to Not a bug in Team Workload Dec 9, 2024
@YYDan YYDan changed the title GM sends it's own (unwanted) packets when an async TCP socket is upgraded to WebSockets In-Game: network_socket_tcp() sockets have unwanted extra packets returned after upgrading manually to Socket.io websockets Dec 9, 2024
@YYDan YYDan closed this as not planned Won't fix, can't repro, duplicate, stale Dec 9, 2024
@github-project-automation github-project-automation bot moved this from Not a bug to Done in Team Workload Dec 9, 2024
@YYDan
Copy link
Collaborator

YYDan commented Dec 9, 2024

Closing per the above comment

@YYDan YYDan moved this from Done to Not a bug in Team Workload Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gmrt-bug In-game bugs with the "GMRT" runtimes
Projects
Status: Not a bug
Development

No branches or pull requests

2 participants