Skip to content

protocol buffers + angular 2 expanding on the example with additional input & ui

License

Notifications You must be signed in to change notification settings

davidwalter0/angular2-protobuf-mqtt-example

 
 

Repository files navigation

Using protobuf with mqtt in angular2

This project is a demonstration of using protobuf with angular2 and mqtt.

The article for this example is located here

Prequisites

You need a running mqtt server with websocket support under port 9001. I can recommend mosquitto. My mosquitto.conf with websockets enabled looks as follows

pid_file /var/run/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

listener 1883

listener 9001 127.0.0.1
protocol websockets

include_dir /etc/mosquitto/conf.d

You also need angular-cli.

npm install -g @angular/cli

Install dependencies

npm install
./node_modules/protobufjs/bin/pbjs -t static-module -w commonjs -o ./src/protobuf/value.protobuf.js ./value.proto
./node_modules/protobufjs/bin/pbts -o ./src/protobuf/value.protobuf.d.ts ./src/protobuf/value.protobuf.js

Run the app

Run ng serve for a server then navigate to http://localhost:4200/ to see the example in action.

About

protocol buffers + angular 2 expanding on the example with additional input & ui

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 80.4%
  • JavaScript 15.4%
  • HTML 2.4%
  • CSS 1.2%
  • Protocol Buffer 0.6%