mirror of
https://github.com/defold/extension-websocket.git
synced 2025-09-27 07:52:18 +02:00
Code cleanup
This commit is contained in:
@@ -16,7 +16,7 @@ background_color {
|
||||
nodes {
|
||||
position {
|
||||
x: 10.0
|
||||
y: 1113.0
|
||||
y: 949.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
@@ -78,7 +78,7 @@ nodes {
|
||||
nodes {
|
||||
position {
|
||||
x: 214.0
|
||||
y: 568.0
|
||||
y: 314.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
@@ -236,7 +236,7 @@ nodes {
|
||||
nodes {
|
||||
position {
|
||||
x: 320.0
|
||||
y: 438.0
|
||||
y: 184.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
@@ -394,7 +394,7 @@ nodes {
|
||||
nodes {
|
||||
position {
|
||||
x: 320.0
|
||||
y: 503.0
|
||||
y: 249.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
@@ -552,7 +552,7 @@ nodes {
|
||||
nodes {
|
||||
position {
|
||||
x: 429.0
|
||||
y: 568.0
|
||||
y: 314.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
@@ -710,7 +710,7 @@ nodes {
|
||||
nodes {
|
||||
position {
|
||||
x: 320.0
|
||||
y: 568.0
|
||||
y: 314.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
|
@@ -57,22 +57,14 @@ end
|
||||
|
||||
local function websocket_callback(self, conn, data)
|
||||
if data.event == websocket.EVENT_DISCONNECTED then
|
||||
log("Disconnected: " .. tostring(conn))
|
||||
self.connection = nil
|
||||
update_gui(self)
|
||||
if data.error then
|
||||
log("Diconnect error:", data.error)
|
||||
self.connection = nil
|
||||
end
|
||||
elseif data.event == websocket.EVENT_CONNECTED then
|
||||
if data.error then
|
||||
log("Connection error:", data.error)
|
||||
self.connection = nil
|
||||
end
|
||||
update_gui(self)
|
||||
log("Connected: " .. tostring(conn))
|
||||
elseif data.event == websocket.EVENT_ERROR then
|
||||
if data.error then
|
||||
log("Error:", data.error)
|
||||
end
|
||||
log("Error: '" .. data.error .. "'")
|
||||
elseif data.event == websocket.EVENT_MESSAGE then
|
||||
log("Receiving: '" .. tostring(data.message) .. "'")
|
||||
end
|
||||
@@ -84,9 +76,6 @@ local function connect(self, scheme)
|
||||
self.url = scheme .. URL
|
||||
log("Connecting to " .. self.url)
|
||||
self.connection = websocket.connect(self.url, params, websocket_callback)
|
||||
if self.connection == nil then
|
||||
print("Failed to connect to " .. self.url .. ": " .. err)
|
||||
end
|
||||
end
|
||||
|
||||
local function disconnect(self)
|
||||
|
Reference in New Issue
Block a user