Skip to content

Commit

Permalink
Fix websocket example files
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptibell committed Oct 17, 2024
1 parent f89d02a commit ef294f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .lune/websocket_client.luau
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ end)

for _ = 1, 5 do
local start = os.clock()
socket.send(tostring(1))
local response = socket.next()
socket:send(tostring(1))
local response = socket:next()
local elapsed = os.clock() - start
print(`Got response '{response}' in {elapsed * 1_000} milliseconds`)
task.wait(1 - elapsed)
Expand All @@ -38,7 +38,7 @@ end
-- Everything went well, and we are done with the socket, so we can close it

print("Closing web socket...")
socket.close()
socket:close()

task.cancel(forceExit)
print("Done! 🌙")
4 changes: 2 additions & 2 deletions .lune/websocket_server.luau
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ local handle = net.serve(PORT, {
handleWebSocket = function(socket)
print("Got new web socket connection!")
repeat
local message = socket.next()
local message = socket:next()
if message ~= nil then
socket.send("Echo - " .. message)
socket:send("Echo - " .. message)
end
until message == nil
print("Web socket disconnected.")
Expand Down

0 comments on commit ef294f2

Please sign in to comment.