Closed Fatal93 closed 4 years ago
I just ran the following:
require("gwsockets")
local socket = GWSockets.createWebSocket("wss://echo.websocket.org")
function socket:onMessage(txt)
for i = 1, #txt do
if (txt[i] != "5") then
print("Fail")
end
end
print(txt[8000])
end
function socket:onError(txt)
print("Error: ", txt)
end
function socket:onConnected()
socket:write(string.rep("5", 8000))
end
socket:open()
And it worked as expected. Could I see your code?
I think I found the problem and it's actually quite a severe bug. I pushed the changes and will probably release a new version today.
I just released 1.2.0, would be great if you could test and see if it is fixed.
Great thanks, I'll give it a test this afternoon once I'm back from work.
I've just done some testing, and can confirm the issue is now fixed. Thank you 👍
I'm using GWSockets to send a JSON Payload to a Websocket server, however during my testing I've come across an issue, seemingly seems to happen at random, I'm not able to find any specific pattern, however the longer the map has been on, the more likely it seems to happen.
Data after 4000 bytes seems to be just replaced with NULL. See my screenshots below:
This is from the Websocket when the JSON conversion fails.
I've tried the following:
Writing the output of util.TableToJSON to disk before send
Taking the JSON from Gmod and putting it through a JS Websocket client ~1000 times (Works without an issue)
I've ruled out that it may be something with the Gmod JSON data or my websocket server so it appears to be an issue with this module.
I'm using the latest version, which at the time of writing is: 1.1.3
If there's any more information you need, let me know.