Skip to content

Instantly share code, notes, and snippets.

@abobija
Created June 18, 2019 16:19
Show Gist options
  • Save abobija/3d89eedc2c3d9712ed0c699c6a0f9ad7 to your computer and use it in GitHub Desktop.
Save abobija/3d89eedc2c3d9712ed0c699c6a0f9ad7 to your computer and use it in GitHub Desktop.
Code written in YouTube video https://youtu.be/Tb3L4UcjlI4
local function init_ws()
require('ws32_client')
.on('receive', function(data, ws)
print('WS received: ', data)
end)
.on('connection', function(ws)
print('WS connected')
local timer = tmr.create()
timer:register(2000, tmr.ALARM_AUTO, function(t)
ws.send('Hello!')
end)
timer:start()
end)
.connect('ws://demos.kaazing.com:80/echo')
end
wifi.mode(wifi.STATION)
wifi.sta.config({
ssid = "Renault 1.9D",
pwd = "renault19",
auto = false
})
wifi.sta.on('got_ip', init_ws)
wifi.start()
wifi.sta.connect()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment