WebSockets
OTClientV8 Websockets
Usage
local url = "ws://otclient.ovh/"
local websocket = HTTP.WebSocket(url, {
onOpen = function(message, websocketId)
end,
onMessage = function(message, websocketId)
end,
onClose = function(message, websocketId)
end,
onError = function(message, websocketId)
end
})
-- it returns
print(websocket.id)
print(websocket.url)
websocket.send("Hello")
scheduleEvent(function()
websocket.close()
end, 5000)Websockets have 15s timeout by default, you can change it in corelib/http.lua
corelib/http.lua WebSocket server
Example server in nodejs
Last updated