npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lan

v0.2.0

Published

Internet of Things Server Layer with CoAP, WebSocket, MQTT, HTTP Protocol.

Downloads

9

Readme

Lan Server Layer

Build Status Code Climate Test Coverage

Internet of Things Server Layer with CoAP, WebSocket, MQTT, HTTP Protocol.

Similar to Ponte & Inspired by Qest

Test on Node Version: 0.12.7

##IoT Architecture:

IoT Struct

##Lan Server Layer:

Lan Struct

##Configure

Default Config:

{
  "encrypt": "crypto",
  "db_url": "mongodb://localhost:27017/lan",
  "db_collection": "documents",
  "db_collection_user": "user",
  "modules": [
    "coap",
    "http",
    "mqtt",
    "websocket"
  ],
  "port": {
    "http": 8899,
    "websocket": 8898,
    "coap": 5683,
    "mqtt": 1883
  },
  "logging" :true,
  "secret": "keyboard cat"
}

###Import make sure change secret

encrypt: ["crypto", "bcrypt"]

modules: ["coap", "http", "mqtt", "websocket"]

Use bcrypt, please install it:

npm install --save bcrypt

##Docker

Require: Docker

docker build .

##安装(Setup)

必装:

  1. MongoDB -> NoSQL: 数据存储
  2. Sqlite || MySQL || PostgreSQL || MariaDB || MSSQL -> SQL: 存储用户信息

然后:

1.Clone

git clone https://github.com/phodal/lan

2.安装依赖

npm install
bower install 

3.修改config下的配置

/config.json 数据库配置
/default.json Lan系统配置   

4.数据库初始化

npm install -g sequelize-cli
sequelize db:migrate

5.Start Cron

npm jobs/cron.js

6.运行

npm start    

##Setup

require: Install

  1. MongoDB
  2. Sqlite || MySQL || PostgreSQL || MariaDB || MSSQL -> SQL: save user info

Then.

1.Install dependencies

npm install

Or Just Production only:

npm install --production

2.Setup Database

sequelize db:migrate 

3.Start Cron

npm jobs/cron.js

4.Run

npm start

##Test With Tool

###HTTP

Get

curl --user root:root -X GET -H "Content-Type: application/json" http://localhost:8899/topics/root

PUT/POST - cUrl

curl --user root:root -X PUT -d '{ "dream": 1 }' -H "Content-Type: application/json" http://localhost:8899/topics/root

###MQTT

Publish - Mosquitto

mosquitto_pub -u root -P root -h localhost -d -t lettuce -m "Hello, MQTT. This is my first message."

Subscribe - Mosquitto

mosquitto_sub -t message -h localhost -u root -P root

###CoAP

POST/PUT - libcoap

coap-client -e "{message: 'hello,world}" -m put coap://127.0.0.1/topic?root:root

GET - libcoap

coap-client -m get coap://127.0.0.1:5683/topic?root:root

GET/POST/PUT - Copper

  1. Visit coap://127.0.0.1:5683/topic?root:root

GET: Click GET

POST: Type on Outgoing, Click POST

###WebSocket

Message

node test_scripts/ws_test.js

##Auth

Standalone (单机)

User -> SQL Database (Auth)

SQL Database -> NoSQL (Save)

Multi

User -> SQL Database (Save)

SQL Database -> NoSQL (Cron Job || MQ)

User -> NoSQL (Auth && Save)

##License

© 2015 Phodal Huang. This code is distributed under the MIT license.