Code Monkey home page Code Monkey logo

device-simulator's Introduction

设备模拟器

运行前请先安装java8.

交互式CLI

$ git clone https://github.com/jetlinks/device-simulator.git
$ cd device-simulator
$ mvn clean package -DskipTests
$ java \
   -Dfile.encoding=UTF-8 \
   -Xmx1G \
   -Dsimulator.max-ports=50000 \
   "-Dsimulator.network-interfaces=.*" \
   -jar ${PWD}/simulator-cli/target/simulator-cli.jar

JVM参数说明:

  1. -Dsimulator.network-interfaces: 指定可用的网卡,正则表达式. 如: eth0|eth1
  2. -Dsimulator.max-ports: 指定可用的端口数量,默认为50000

DEMO

MQTT 官方协议模拟

在项目根目录启动模拟器后执行命令:

benchmark mqtt --size=5000 --name=mqtt --host=127.0.0.1 --port=1883 --script=benchmark/mqtt/benchmark.js

注意: 默认的clientId格式在benchmark/mqtt/benchmark.js中定义,默认为mqtt-test-{index}. 可修改代码或者通过命令参数deviceIdPrefix=mqtt-test-来修改.

TCP 官方协议模拟

在项目根目录启动模拟器后执行命令:

benchmark tcp --size=1 --id=tcp-test-{index} --name=tcp --host=127.0.0.1 --port=8801 --script=benchmark/tcp/benchmark.js

注意: --id=tcp-test-{index}参数,表示在平台的tcp设备id格式为tcp-test-{index},如:tcp-test-0

常见问题

  1. 连接提示no further information ...,请在启动或者创建连接时指定网卡信息 benchmark --interface 192....

device-simulator's People

Contributors

zhou-hao avatar dependabot[bot] avatar bestfeng1020 avatar kernelj avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.