Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 457eba0

Browse files
committed
Update to Blynk.Cloud
1 parent 8e494c8 commit 457eba0

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

blynk.lua

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
local Pipe = require("blynk.pipe")
44

5-
local COMMAND = { rsp = 0, login = 2, ping = 6, tweet = 12, email = 13, notify = 14, bridge = 15, hw_sync = 16, internal = 17, set_prop = 19, hw = 20, hw_login = 29, debug = 55, event = 64 }
5+
local COMMAND = { rsp = 0, login = 2, ping = 6, bridge = 15, hw_sync = 16, internal = 17, set_prop = 19, hw = 20, hw_login = 29, redirect = 41, debug = 55, event = 64 }
66
local STATUS = { success = 200, invalid_token = 9 }
77
local STATE_AUTH = "auth"
88
local STATE_CONNECT = "connected"
@@ -31,7 +31,7 @@ local Blynk = {
3131
log = function(...) end,
3232
_gettime = function() return os.time() end,
3333
}
34-
Blynk._VERSION = "0.1.4"
34+
Blynk._VERSION = "0.2.0"
3535
Blynk.__index = Blynk
3636

3737
print([[
@@ -65,14 +65,6 @@ function Blynk:syncVirtual(...)
6565
self:sendMsg(COMMAND.hw_sync, nil, 'vr\0'..table.concat({...}, '\0'))
6666
end
6767

68-
function Blynk:notify(msg)
69-
self:sendMsg(COMMAND.notify, nil, msg)
70-
end
71-
72-
function Blynk:tweet(msg)
73-
self:sendMsg(COMMAND.tweet, nil, msg)
74-
end
75-
7668
function Blynk:logEvent(evt, descr)
7769
self:sendMsg(COMMAND.event, nil, table.concat({evt, descr}, '\0'))
7870
end
@@ -170,6 +162,8 @@ function Blynk:process(data)
170162
elseif args[1] == 'vr' then
171163
self:emit("readV"..args[2])
172164
end
165+
elseif cmd == COMMAND.redirect then
166+
--TODO
173167
elseif cmd == COMMAND.debug then
174168
print("Server says: "..args[1])
175169
elseif cmd == COMMAND.internal then

examples/client.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ assert(#arg >= 1, "Please specify Auth Token")
1414
local auth = arg[1]
1515

1616
local blynk = Blynk.new(auth, {
17-
heartbeat = 10, -- default h-beat is 30
17+
heartbeat = 30, -- default h-beat is 50
1818
--log = print,
1919
})
2020

2121
local function connectBlynk()
22-
local host = "blynk-cloud.com"
22+
local host = "blynk.cloud"
2323

2424
local sock = assert(socket.tcp())
2525
sock:setoption("tcp-nodelay", true)

examples/nodemcu.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ blynk = Blynk.new(config.auth, {
1717
})
1818

1919
local function connectBlynk()
20-
local host = "blynk-cloud.com"
20+
local host = "blynk.cloud"
2121

2222
local sock, port
2323
--[[TODO: TLS didn't work for some reason, commented out

0 commit comments

Comments
 (0)