20.03.2018, 14:27
Attached is websocket client library ported from https://github.com/lipp/lua-websockets/
Main changes:
1. Support for basic auth in URL
2. Receive timeout does not close the websocket connection
3. Server support is removed
Add it as a user library named websocket
Minimal example (resident script):
Main changes:
1. Support for basic auth in URL
2. Receive timeout does not close the websocket connection
3. Server support is removed
Add it as a user library named websocket
Minimal example (resident script):
Code:
if not ws then
ws = require('user.websocket')
url = 'ws://admin:admin@192.168.1.12/apps/localbus.lp'
-- mode is either sync or copas, second parameter sets timeout in seconds
client = ws.client('sync', 10)
client:connect(url)
end
log(client:receive())