Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Subnum12 opened this issue Nov 23, 2024 · 0 comments
Open

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

Subnum12 opened this issue Nov 23, 2024 · 0 comments

Comments

@Subnum12
Copy link

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

  1. 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:

  • Adapter version: v2.0.3
  • JS-Controller version: v8.8.3
  • Node version: v20.18.0

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant