ioBroker / ioBroker.rest-api

Swagger UI for ioBroker
Apache License 2.0
12 stars 8 forks source link

/sendto/javascript.0?message=toScript #118

Open Subnum12 opened 1 day ago

Subnum12 commented 1 day ago

Describe the bug
It is not possible to send messages to a dedicated script. Maybe just missing documentation but I guess its a bug.

To Reproduce
Steps to reproduce the behavior:

  1. I'm running this script with no error:

    Script ``` sendTo( 'javascript.0', 'toScript', { script: 'script.js.dev.Test-js', message: 'Testmessage', data: {msg: 'Test MSG' } }, (res) => { console.log(JSON.stringify(res)); } ); onMessage('Testmessage', (messagedata, callback) => { console.log('recive'); const myData = { input: messagedata, output: { name: 'Test' } }; callback(myData); }); ```

    grafik

  2. trying to run with ioBroker.rest-api I'm not able to receive any message. /rest-api/v1/sendto/javascript.0?message=toScript&data={script:"script.js.dev.Test-js","message":"Testmessage","data":{msg:"FROM REST-API"}}&timeout=600&noResponse=false it result in timeout.

Expected behavior
I would expect to receive the message. However, onMessage gets not executed.

Versions:

Additional context
The provided example from https://github.com/ioBroker/ioBroker.rest-api, I guess implemented with issues #18 does not make sense to me as it references to scriptName but does not use it and required parameter script from toScript is not specified at all.

http://ipaddress:8093/v1/sendto/javascript.0?message=toScript&data={"message":"MESSAGE","data":"FROM REST-API"} - send a message to javascript.0 in script scriptName

Additional using Swagger UI I'm always getting "No message provided" grafik

grafik