Logic Machine Forum
Creation of custom package - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: General (https://forum.logicmachine.net/forumdisplay.php?fid=2)
+--- Thread: Creation of custom package (/showthread.php?tid=1294)

Pages: 1 2


RE: Creation of custom package - Erwin van der Zwart - 11.12.2023

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?


RE: Creation of custom package - admin - 11.12.2023

This only affects copas version, sync should work correctly. It works for me with this library version: https://forum.logicmachine.net/showthread.php?tid=1294&pid=16878#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