Comments (14)
Running same pkg version (5.8.1) but node 20.11.1.
Anyway, not related to this great tool. So, I'll close this.
Thanks for great help. Much appreciated.
from mqttx.
My questions were answered :)
from mqttx.
@golfvert Hi. Thanks for your use.
Currently, it's not possible to dynamically add a built-in test scenario at runtime within mqttx-cli
. We might support this functionality in the future. For the time being, here's the recommended workaround to include your custom test scenario:
- Download the source code and add a TypeScript (.ts) file to the
cli/scenarios
folder, mimicking the format of the existing built-in scenario files.
Then, proceed with either of the following steps based on your needs:
- For local development and packaging:
- Ensure Node.js and Yarn are installed.
- Run
yarn build
in the project root to compile TypeScript files. - If needed, install the
pkg
package and usepkg .
to generate an executable binary found in the release folder.
Or,
- For Docker deployment:
- Run
docker build -t mqttx-cli .
to create a Docker image with your custom scenario, and rundocker run -it mqttx-cli
- Run
![image](https://private-user-images.githubusercontent.com/21299158/309643849-ffb19da5-9068-4953-80cd-91460327311a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg1NzM5NjksIm5iZiI6MTcxODU3MzY2OSwicGF0aCI6Ii8yMTI5OTE1OC8zMDk2NDM4NDktZmZiMTlkYTUtOTA2OC00OTUzLTgwY2QtOTE0NjAzMjczMTFhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE2VDIxMzQyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkyNTRlNDYzYzFjZGJkMGMyMTU1ZDc0MTkwMTU3ZWJjOWJjZmJkYmMzMzViMzVjMGIxOGJmNDlkODEyY2NhZDQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.jpVn8hhgzPbAhxYN6fPgpf6narBLDPaYqOQYA46khWc)
![image](https://private-user-images.githubusercontent.com/21299158/309643892-0bfe712f-fd57-44a5-be7d-dadfb8c70155.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg1NzM5NjksIm5iZiI6MTcxODU3MzY2OSwicGF0aCI6Ii8yMTI5OTE1OC8zMDk2NDM4OTItMGJmZTcxMmYtZmQ1Ny00NGE1LWJlN2QtZGFkZmI4YzcwMTU1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE2VDIxMzQyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNiYTRiOWViYzZlYjdiZTE5YjYwMjNkODY0Mzk1NTQyMzNlOTJiMjMxMGMxMTEyYTE4NGZjZWQ0MDA5OGUyMWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.j8zf_4iSubH4qDDp5Kc2KlLdhZ1PFKRnVMWS8PqcQa4)
from mqttx.
Hi,
Thank you for your answer. By looking into the code, I saw that it wasn't dynamic.
However, even after done the yarn build
I can't find the new scenario. Do I need to package it ?
At runtime, which directory is used to find the scenario ?
I can't see it in node_modules/mqttx-cli/dist/src/scenarios/
Not sure why, though...
from mqttx.
Hi,
It's best not to modify anything directly in `node_modules/mqttx-cli. Instead, please follow these steps:
- Clone the
MQTTX
repo and make changes in the cloned directory, not innode_modules
. - Add your scenario in the
cli/scenarios
folder. - Build the project with
yarn build
ornpm run build
in the root directory of your cloned project.
This approach ensures your changes are saved and tracked correctly.
from mqttx.
This is what I have done... I have added my new scenario in my cloned directory is cli/src/scenario. I run yarn build
. All seems to be fine:
laptop-2:cli me$ ls -l src/scenarios/
total 40
-rwxr-xr-x@ 1 me staff 2195 Feb 29 03:53 IEM.ts
-rwxr-xr-x@ 1 me staff 2620 Feb 29 03:53 smart_home.ts
-rwxr-xr-x@ 1 me staff 3921 Feb 29 03:53 tesla.ts
-rwxr-xr-x@ 1 me staff 3805 Feb 29 03:53 weather.ts
-rwxr-xr-x@ 1 me staff 1068 Mar 3 19:49 test.ts
laptop-2:cli me$ touch src/scenarios/test.ts
laptop-2:cli me$ yarn build
yarn run v1.22.21
$ tsc
✨ Done in 2.12s.
laptop-2:cli me$ ls-l dist/src/scenarios/
-bash: ls-l: command not found
laptop-2:cli me$ ls -l dist/src/scenarios/
total 56
-rw-r--r-- 1 me staff 2944 Mar 3 15:18 IEM.js
-rw-r--r-- 1 me staff 2839 Mar 3 15:18 smart_home.js
-rw-r--r-- 1 me staff 4424 Mar 3 15:18 tesla.js
-rw-r--r-- 1 me staff 4788 Mar 3 15:18 weather.js
-rw-r--r-- 1 me staff 1762 Mar 3 19:49 test.js
laptop-2:cli me$ ./node_modules/.bin/mqttx ls --scenarios
You can use any of the above scenario names as a parameter to run the scenario.
┌───────────────┬──────────────────────────────────────────────────────────────────────────────────────────────┐
│ Scenario Name │ Description │
├───────────────┼──────────────────────────────────────────────────────────────────────────────────────────────┤
│ IEM │ Simulation to generate Industrial Energy Monitoring data. │
├───────────────┼──────────────────────────────────────────────────────────────────────────────────────────────┤
│ smart_home │ Simulation to generate Smart Home data. │
├───────────────┼──────────────────────────────────────────────────────────────────────────────────────────────┤
│ tesla │ Simulation to generate Tesla's data, reference form https://github.com/adriankumpf/teslamate │
├───────────────┼──────────────────────────────────────────────────────────────────────────────────────────────┤
│ weather │ Simulation to generate advanced weather station's data. │
└───────────────┴──────────────────────────────────────────────────────────────────────────────────────────────┘
laptop-2:cli me$
from mqttx.
To run the ./node_modules/.bin/mqttx ls --scenarios
command, make sure to first run yarn dev
in the development environment.
from mqttx.
I am totally ignorant on yarn... Sorry.
yarn dev gives me this:
[11:06:15 AM] Starting compilation in watch mode...
[11:06:16 AM] Found 0 errors. Watching for file changes.
And nothing else.
This is my lack of knowledge on yarn that prevent this to work, I guess...
from mqttx.
And running
laptop-2:cli remy$ pkg .
> [email protected]
> Warning Failed to make bytecode node16-x64 for file /snapshot/cli/node_modules/axios/index.js
> Warning Failed to make bytecode node16-x64 for file /snapshot/cli/node_modules/axios/lib/axios.js
> Warning Failed to make bytecode node16-x64 for file /snapshot/cli/node_modules/axios/lib/utils.js
> Warning Failed to make bytecode node16-x64 for file /snapshot/cli/node_modules/axios/lib/helpers/bind.js
...
fails.
which is apparently a known bug... axios/axios#5650
:(
from mqttx.
Docker build works though:
docker run -it mqttx-cli
/app # mqttx ls --scenarios
You can use any of the above scenario names as a parameter to run the scenario.
┌───────────────┬──────────────────────────────────────────────────────────────────────────────────────────────┐
│ Scenario Name │ Description │
├───────────────┼──────────────────────────────────────────────────────────────────────────────────────────────┤
│ IEM │ Simulation to generate Industrial Energy Monitoring data. │
├───────────────┼──────────────────────────────────────────────────────────────────────────────────────────────┤
│ smart_home │ Simulation to generate Smart Home data. │
├───────────────┼──────────────────────────────────────────────────────────────────────────────────────────────┤
│ tesla │ Simulation to generate Tesla's data, reference form https://github.com/adriankumpf/teslamate │
├───────────────┼──────────────────────────────────────────────────────────────────────────────────────────────┤
│ weather │ Simulation to generate advanced weather station's data. │
├───────────────┼──────────────────────────────────────────────────────────────────────────────────────────────┤
│ test │ test │
└───────────────┴──────────────────────────────────────────────────────────────────────────────────────────────┘
/app #
I guess I'll do that...
from mqttx.
Great to see you've successfully run your custom scenario in Docker!
You need to run yarn dev
to initiate the development environment for local development. Afterward, you should use the command from the project's root directory, like node ./bin/index.js conn -h broker.emqx.io
, instead of using anything from node_modules
. This ensures your custom scenario is correctly recognized and executed.
Hope this helps solve your issue!
from mqttx.
Thanks for the good advices. Super helpful.
Any comment on the pkg .
issue above ?
from mqttx.
I have no idea about this, but I can share my versions about Node.js and pkg.
pkg -v
5.8.1
node -v
v16.14.2
Hope helpful to you.
from mqttx.
Thanks for using it. I will solve this issue.
from mqttx.
Related Issues (20)
- [Bug] *All* pane misses messages but they reappear after switching to *Recieved* pane and back HOT 1
- [Feature] Flathub Verification HOT 1
- [Bug] the title of bug report HOT 1
- Function keys block published content HOT 2
- large TEXT as a publish starts to not obey a new line HOT 4
- [Bug]Can not encode the embedded oneof keyword type in sparkplugb proto schema HOT 3
- Where do I specify the Authentication Method and Authentication Data for MQTT v5? HOT 1
- [Feature] Add version information to Help menu HOT 1
- [Feature] Add support for TLS 1.3 HOT 6
- [Feature] need a "saved payload" for every connection and globally. NOT just the topic HOT 7
- [Bug] Some subscription filters not showing published messages HOT 2
- [Feature] Delete a subscription from a connection
- MQTTX Connection Issues with RabbitMQ MQTT HOT 2
- mqtt.com url is working on both http. Need to disable it HOT 6
- CLI WSS auth using Client + Cert does not work, but Username + Password does HOT 6
- [Bug] CLI Publish retries in loop if disconnected by invalid topic HOT 2
- [Bug] wrong username/pawword keeps try to connect even after i have changed it to correctly one HOT 4
- [Bug] Subscription Rejection Causes Subsequent Channels to Fail HOT 2
- [Bug] Update broken HOT 1
- Binary sent is not the same as binary received
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mqttx.