This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Creation of custom package
#21
I experience the same problem...
Code:
-- mode is either sync or copas, second parameter sets timeout in seconds
client, err = ws.client('sync', 10)
...
frame, opcode, clean, code, reason = client:receive()
log(frame, opcode, clean, code, reason)
if frame then
...
elseif reason ~= 'timeout' then
....
end
I would expect reason "timeout" every 10 seconds but nothing is returned so it keeps hanging in the receive forever...

Any workaround for this?
Reply
#22
This only affects copas version, sync should work correctly. It works for me with this library version: https://forum.logicmachine.net/showthrea...8#pid16878

Code:
ws = require('user.ws')

client = ws.client('sync', 10)
client:connect('ws://admin:password@127.0.0.1/apps/localbus.lp')

while true do
  log(client:receive())
end
Reply


Forum Jump: