Closed iBicha closed 6 years ago
@iBicha Hello~ The modified code will be merged soon. Thanks~ :) But I wonder in which case ArgumentException occurs. Could you dump and show your answer packet? Because the answer packet made by socket.io server code and it can't be make any json parsing error.
I can provide a dump tomorrow, but i remember well the packet started and ended with a number, with the json payload in between.
@iBicha Hmm.. Can you tell me which version of socket.io-server installed? We're only supporting socket.io upto v1.7.4 and not v2.
@ppz0th Oh I see now! it's a "socket.io": "^2.0.1" in the package.json so that might be it. On a side note, this got it working, so why not consider a v2 compatibility since it's easy to support?
@iBicha Really??;;;; Last time i tested it didn't work at all. I will check on socket.io V2 right now :)
Yes, after this change, I was able to get a simple chat going between Unity and the browser with a v2 server running. Here's a dump of the response that this PR fixes:
97:0{"sid":"zrd2ZurkTf49oFrVAAAC","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}2:40
As you can see there is some padding to the JSON.
According to the engine.io protocol, 97 is probably the size, and 0 should be to indicate type open
What is weird is the appended meta data, where 2 should indicate a ping message, but it's weird to have it at the end of the packet
@ppz0th where you able to run it?
Fixes ArgumentException: JSON parse error: The document root must not follow by other values.
While the code checks for string starting with "{", it didnt check for ending with "}".