Defolder,
This may be the wrong place to post this, but my current test program using the DefoldWebSocket extension (And the 2 dependencies, LuaSec and LuaSocket).
My current program should attempt a connection to a test server hosted on a repl but the server receives nothing.
My main.script is as follows:
local client_async = require "websocket.client_async"
function init(self)
print("initialized network module")
self.ws = client_async({
connect_timeout = 10,
})
self.servertoken = "OXPqhF+MJO%Gn|vstuIRK8csRdg=59RTnW6%K=1o$wZrF!o3GAMzutJlcPlSoTcvNbH9AKnmU8MY^nk4fz&+3Vgt%?^ZfJfAAVI0_qTYjO_|mSlIKi##OahEFK_z+81K|vjuu!aoJBKwxRKr&|USxY_*-=Uukrk966dqFAJuWQs&u0QgnxZdUzPaSYOLmu$SAcBh#chfM3!IEJs9@0@_An-9BrTigtbRkGgCwxS-2EJ$yovp%TINbb$CNLKG2X%d"
self.serveraddress = "ws://parry-host.grify.repl.co:25434"
local sslparams = {
mode = "client",
protocol = "tlsv1_2",
verify = "none",
options = "all",
}
self.ws:on_connected(function(ok, err)
if ok then
print("Connected ws")
else
print("Unable to connect", err)
end
end)
self.ws:on_disconnected(function()
print("Disconnected")
end)
self.ws:on_message(function(message)
print("Received message".. message)
end)
print("Touch!")
print("Trying to reach Parry servers")
self.ws:connect("ws://super-basic-ws-server.grify.repl.co", self.servertoken)
end
Thank you,
Grify
P.S. I suppose I’ll have to change the server token now, won’t I XD
Yes, I tested the server with a vanilla node WS client and it worked perfectly. I even did a full rewrite of the server and client to be the most bare bones version that should still work, and it didn’t.
I did a bit of debugging and the code manages to create a TCP socket to 35.201.120.147 on port 25434. It then goes into a loop waiting for the socket to be writable, but it never becomes ready. I do not know why.
Does defoldwebsocket not support custom ports, or ports in a certain range? My tests on ports localhost:80, localhost:443, localhost:8080, 20222 and of course 25434. None of them worked, but neither did a connection to ws://echo.websocket.org which seems to not connect as well.
Here’s my (condensed) client code that is failing to connect to them all:
local client_async = require "websocket.client_async"
function init(self)
self.ws = client_async({
connect_timeout = 10,
})
self.ws:on_connected(function(ok, err)
if ok then
print("Connected ws")
else
print("Unable to connect", err)
end
end)
self.ws:on_disconnected(function()
print("Disconnected")
end)
self.ws:on_message(function(message)
print("Received message".. message)
end)
self.ws:connect("ws://echo.websocket.org")
end
and here is my WebSocketServer code (nodeJS, can be run locally with node cli or on repl.it):
isn’t optional.
And apparently my vision isn’t quite what I thought it was either.
Apologies for causing such a commotion over such a simple error, but thank you very much for your support, it was much more than inspiring.
See you next time with a missing semicolon,
Honestly thanks for your help,
grify
It happens. Just today I accidentally put steamworks.final() in our game’s update function and spent longer than I should have trying to figure out why it wasn’t working.
Thank you so much! You’re always very helpful!
I can’t wait to reformat my server to actually work properly now :]
Have a pleasant week!
Thanks again,
grify