[SDK] Can't receive messages with LrSocket
Hi!
I need to send messages via sockets to Lr. The communincation between my client and netcat (as a server) goes well, the messages are sent. However, I can't get any messages in Lr. Based on the logs onConnecting, onConnection, onError and onClosed are triggered, but it looks likes onMessage is not. I've replicated this with my client and with netcat as a client.
The lua code is the following:
LrTasks.startAsyncTask(function()
LrFunctionContext.callWithContext( 'socket', function( context )
local running = true
local socket = LrSocket.bind {
functionContext = context,
plugin = _PLUGIN,
port = 19684,
mode = 'receive',
onMessage = function(socket, message)
outputToLog("Message!")
--Never happens
end,
onClosed = function (socket)
outputToLog("Closed")
running = false
end,
onError = function (socket, err)
socket:reconnect()
outputToLog("Error: " .. err)
end,
onConnecting = function( socket, port )
outputToLog("Waiting for connection on port " .. port)
end,
onConnected = function (socket, port)
outputToLog("New connection!")
end}
while running do LrTasks.sleep (0.1) end
socket:close ()
end )
end )
Do you guys have an idea?
Thanks!