You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
453 B
23 lines
453 B
local url = "wss://ws.novalea.fr/ws"
|
|
|
|
local ws, err = http.websocket(url)
|
|
|
|
if not ws then
|
|
print("Erreur de connexion :", err)
|
|
return
|
|
end
|
|
|
|
print("Connecté !")
|
|
|
|
while true do
|
|
local event, msg = os.pullEvent()
|
|
|
|
if event == "websocket_message" then
|
|
print("Serveur:", msg)
|
|
elseif event == "key" then
|
|
ws.send("ping")
|
|
elseif event == "websocket_closed" then
|
|
print("WebSocket fermée.")
|
|
break
|
|
end
|
|
end |