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.
22 lines
450 B
22 lines
450 B
local url = "ws://ws.novalea.fr/ws" -- Mets ici l'URL du serveur websocket
|
|
|
|
print("Connexion au websocket...")
|
|
local ws, err = http.websocket(url)
|
|
|
|
if not ws then
|
|
print("Erreur de connexion : " .. tostring(err))
|
|
return
|
|
end
|
|
|
|
print("Connecté !")
|
|
|
|
-- Envoi d'un message
|
|
ws.send("Hello serveur !")
|
|
|
|
-- Boucle de réception
|
|
while true do
|
|
local message, isBinary = ws.receive()
|
|
if message then
|
|
print("Reçu :", message)
|
|
end
|
|
end |