require('net')
conn=net.createConnection(net.TCP, 1)
conn:on("receive", function(conn, payload) print(payload) end )
conn:connect(443,"108.59.13.232")
conn:send("GET /1/messages.json HTTP/1.1\r\n")
conn:send("Host: api.pushover.net\r\n")
conn:send("Pragma: no-cache\r\n")
conn:send("Cache-Control: no-cache\r\n")
conn:send("Content-Type: application/x-www-form-urlencoded\r\n")
conn:send("Accept: */*\r\n\r\n")
conn:close()But when i try to execute the above from a function or in a file it doesn't work. For example if I write the above to a file called test.lua and then run the following in the immediate window or from within init.lua nothing happens.
dofile("test.lua")Does anyone have any idea what i'm doing wrong?
PS. I'm running: NodeMcu 0.9.5 build 20150105 powered by Lua 5.1.4
Thanks