Giter Club home page Giter Club logo

meshblu's Introduction

Meshblu

Meshblu is a cross-protocol IoT machine-to-machine instant messaging system. It is the core messaging system for Citrix's Octoblu IoT platform.

Supported Protocols: HTTP, Socket.io, Websocket, MQTT, CoAP, AMQP, and XMPP.

Version 2.0

We have completely re-written Meshblu into many small components or micro-services. This Meshblu 1.0 repository is being preserved for historical reference.

All of the new Meshblu components are prefixed with meshblu-core. See a list here.

Meshblu is dependent on node.js, redis, mongodb, and either npm or yarn.

Production

In order to run a barebones meshblu-core cluster, you'll need the following repositories.

  1. meshblu-core-dispatcher
  2. meshblu-core-worker-webhook
  3. meshblu-core-protocol-adapter-http

All meshblu-core services and workers have a Dockerfile.

A production Meshblu cluster will consist of many services and workers. We currently don't have documentation for running a complex cluster but we are working on it.

Development

For development use, you can run the bundled barebones cluster:

Installation

git clone https://github.com/octoblu/meshblu
cd meshblu
npm install

See Usage

node command.js --help

Basic Example w/ env

#!/bin/bash

# For development usage only

env \
  PRIVATE_KEY_BASE64="..." \
  PUBLIC_KEY_BASE64="..." \
  PEPPER='some-random-string' \
  MESHBLU_HTTP_PORT='3000' \
  node command.js

See ./test-start.sh

Basic Example w/ args

#!/bin/bash

# For development usage only

node command.js \
  --private-key-base64 '...' \
  --public-key-base64 '...' \
  --pepper 'some-other-random-string' \
  --meshblu-http-port 3000

Debug Mode

It is normal not see any debug output by default. If you want to see debug output, use the environment DEBUG=*, or something more specific, like DEBUG=meshblu*.

It's Alive!

To verify that Meshblu 2.0 is alive and well, open http://localhost:3000/status in a web browser or open a new terminal tab and run:

curl http://localhost:3000/status

You should see Meshblu 2.0 respond with:

{"meshblu":"online"}

You can register a new IoT device by running:

curl -X POST http://localhost:3000/devices

You should see Meshblu 2.0 respond with an authentication UUID and Token as well as the device's security whitelist settings like this:

{ online: false,
  discoverWhitelist: [ '*' ],
  configureWhitelist: [ '*' ],
  sendWhitelist: [ '*' ],
  receiveWhitelist: [ '*' ],
  uuid: 'b112c941-7973-4e2b-8dbe-b7bba27ae199',
  meshblu:
   { createdAt: '2016-11-15T16:07:07.801Z',
     hash: 'Dy5NlIlmygrrnhp0Cln+zb77nHlYdobc+HwbRVzWdPs=' },
  _id: '582b32ab67899618f48c2e1b',
  token: 'd5bcf1a57f4ccefa0ecdc672c7090e7949cc8244' }

Meshblu API Documentation

Checkout our developer docs for more information on our HTTP REST API as well as documentation for all other protocol APIs, security whitelists and blacklists, connectors, data forwarders, and overall Meshblu architecture.

Introducing the Meshblu CLI

We have a convenient command line interface for simplifying the interaction with the Meshblu API.

# Install the meshblu cli utility
npm install --global meshblu-util
# Register a device
meshblu-util register -U http://localhost:3000 > meshblu.json
# Fetch the device
meshblu-util get
# Update the device
meshblu-util update -d '{"type": "some-device"}'
# Fetch the updated device
meshblu-util get

List of meshblu-core components

Workers

  1. meshblu-core-dispatcher
  2. meshblu-core-worker-webhook

Protocol Adapters

  1. meshblu-core-protocol-adapter-socket.io
  2. meshblu-core-protocol-adapter-http
  3. meshblu-core-protocol-adapter-xmpp
  4. meshblu-core-protocol-adapter-coap
  5. meshblu-core-protocol-adapter-mqtt
  6. meshblu-core-protocol-adapter-http-streaming

Firehoses

  1. meshblu-core-worker-firehose-amqp
  2. meshblu-core-firehose-socket.io

Balancers

  1. meshblu-haproxy
  2. meshblu-balancer-http-streaming
  3. meshblu-balancer-firehose-socket.io
  4. meshblu-balancer-xmpp
  5. meshblu-balancer-websocket
  6. meshblu-balancer-mqtt
  7. meshblu-balancer-coap
  8. meshblu-balancer-socket.io

Core Datastores

  1. meshblu-core-datastore
  2. meshblu-core-cache

Core Managers

  1. meshblu-core-manager-token
  2. meshblu-core-manager-device
  3. meshblu-core-manager-hydrant
  4. meshblu-core-manager-whitelist
  5. meshblu-core-manager-webhook
  6. meshblu-core-manager-subscription
  7. meshblu-core-manager-root-token
  8. meshblu-core-manager-messenger

Core Tasks

  1. meshblu-core-task-black-list-token
  2. meshblu-core-task-check-broadcast-received-whitelist
  3. meshblu-core-task-check-broadcast-sent-whitelist
  4. meshblu-core-task-check-configure-as-whitelist
  5. meshblu-core-task-check-configure-whitelist
  6. meshblu-core-task-check-discover-as-whitelist
  7. meshblu-core-task-check-discover-whitelist
  8. meshblu-core-task-check-discoveras-whitelist
  9. meshblu-core-task-check-forwarded-for
  10. meshblu-core-task-check-receive-as-whitelist
  11. meshblu-core-task-check-receive-whitelist
  12. meshblu-core-task-check-root-token
  13. meshblu-core-task-check-send-as-whitelist
  14. meshblu-core-task-check-send-whitelist
  15. meshblu-core-task-check-token
  16. meshblu-core-task-check-token-black-list
  17. meshblu-core-task-check-token-cache
  18. meshblu-core-task-check-update-device-is-valid
  19. meshblu-core-task-check-whitelist-broadcast-as
  20. meshblu-core-task-check-whitelist-broadcast-received
  21. meshblu-core-task-check-whitelist-broadcast-sent
  22. meshblu-core-task-check-whitelist-configure-as
  23. meshblu-core-task-check-whitelist-configure-received
  24. meshblu-core-task-check-whitelist-configure-sent
  25. meshblu-core-task-check-whitelist-configure-update
  26. meshblu-core-task-check-whitelist-discover-as
  27. meshblu-core-task-check-whitelist-discover-view
  28. meshblu-core-task-check-whitelist-message-as
  29. meshblu-core-task-check-whitelist-message-from
  30. meshblu-core-task-check-whitelist-message-received
  31. meshblu-core-task-check-whitelist-message-sent
  32. meshblu-core-task-create-session-token
  33. meshblu-core-task-create-subscription
  34. meshblu-core-task-deliver-webhook
  35. meshblu-core-task-enforce-message-rate-limit
  36. meshblu-core-task-enqueue-deprecated-webhooks
  37. meshblu-core-task-enqueue-jobs-for-forward-broadcast-received
  38. meshblu-core-task-enqueue-jobs-for-forward-configure-received
  39. meshblu-core-task-enqueue-jobs-for-forward-unregister-received
  40. meshblu-core-task-enqueue-jobs-for-subscriptions-broadcast-received
  41. meshblu-core-task-enqueue-jobs-for-subscriptions-broadcast-sent
  42. meshblu-core-task-enqueue-jobs-for-subscriptions-configure-received
  43. meshblu-core-task-enqueue-jobs-for-subscriptions-configure-sent
  44. meshblu-core-task-enqueue-jobs-for-subscriptions-message-received
  45. meshblu-core-task-enqueue-jobs-for-subscriptions-message-sent
  46. meshblu-core-task-enqueue-jobs-for-subscriptions-unregister-received
  47. meshblu-core-task-enqueue-jobs-for-subscriptions-unregister-sent
  48. meshblu-core-task-enqueue-jobs-for-webhooks-broadcast-received
  49. meshblu-core-task-enqueue-jobs-for-webhooks-broadcast-sent
  50. meshblu-core-task-enqueue-jobs-for-webhooks-configure-received
  51. meshblu-core-task-enqueue-jobs-for-webhooks-configure-sent
  52. meshblu-core-task-enqueue-jobs-for-webhooks-message-received
  53. meshblu-core-task-enqueue-jobs-for-webhooks-message-sent
  54. meshblu-core-task-enqueue-jobs-for-webhooks-unregister-received
  55. meshblu-core-task-enqueue-jobs-for-webhooks-unregister-sent
  56. meshblu-core-task-enqueue-webhooks
  57. meshblu-core-task-find-and-update-device
  58. meshblu-core-task-forbidden
  59. meshblu-core-task-get-authorized-subscription-types
  60. meshblu-core-task-get-broadcast-subscription-types
  61. meshblu-core-task-get-device
  62. meshblu-core-task-get-device-public-key
  63. meshblu-core-task-get-global-public-key
  64. meshblu-core-task-get-status
  65. meshblu-core-task-get-subscriptions
  66. meshblu-core-task-migrate-root-token
  67. meshblu-core-task-no-content
  68. meshblu-core-task-protect-your-as
  69. meshblu-core-task-publish-broadcast-received
  70. meshblu-core-task-publish-configure-received
  71. meshblu-core-task-publish-deprecated-subscriptions
  72. meshblu-core-task-publish-message
  73. meshblu-core-task-publish-message-received
  74. meshblu-core-task-publish-subscriptions
  75. meshblu-core-task-publish-unregister-received
  76. meshblu-core-task-register-device
  77. meshblu-core-task-reject-your-as
  78. meshblu-core-task-remove-device-cache
  79. meshblu-core-task-remove-root-session-token
  80. meshblu-core-task-remove-subscription
  81. meshblu-core-task-remove-token-cache
  82. meshblu-core-task-reset-token
  83. meshblu-core-task-revoke-all-tokens
  84. meshblu-core-task-revoke-session-token
  85. meshblu-core-task-revoke-token-by-query
  86. meshblu-core-task-search-device
  87. meshblu-core-task-search-token
  88. meshblu-core-task-send-message
  89. meshblu-core-task-send-message-2
  90. meshblu-core-task-unregister-device
  91. meshblu-core-task-update-device
  92. meshblu-core-task-update-message-rate

Clients

  1. node-meshblu-socket.io
  2. node-meshblu-firehose-socket.io
  3. node-meshblu-http
  4. node-meshblu-websocket
  5. node-meshblu-mqtt
  6. node-meshblu-xmpp
  7. node-meshblu-amqp
  8. node-meshblu-coap
  9. browser-meshblu-http
  10. swift-meshblu-http

Utilities

  1. meshblu-util

Legacy Meshblu 1.x

View it here

meshblu's People

Contributors

abemassry avatar alexbeletsky avatar anthonywebb avatar bassdread avatar chrismatthieu avatar ctlaltdieliet avatar deadprogram avatar eelcocramer avatar erikwilson avatar iamruinous avatar kmariano avatar kstaken avatar leggetter avatar mat-13 avatar monteslu avatar peterdemartini avatar phlipper avatar ra4king avatar redaphid avatar rickcarlino avatar roskoff avatar royvandewater avatar rsbohn avatar sqrtofsaturn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meshblu's Issues

Installing on windows

Hi,

I am trying to install on windows server 2012, but am struggling to get started and wondered if you can provide a little guidance?

Also I already have mosquitto running mqtt is it possible to configure to work with my existing mqtt broker?

Many thanks

Andy

What other projects to try out next

Hi,

Just looking for ideas as to what else to connect around the house.
Can android mobile phone/tablet be connected up? Could you get the status of when its connected to the home wifi it would send a message this person is now home?

I do have an alertme home monitoring system connected up with motion detectors. Details can only be retrieved using they own api (think its done in python).

thanks

What is the purpose of double authentication when streaming?

Hi guys,

What is the point of putting a Token / UUID in both the URL and in the header? Wouldn't having a devices token be adequate enough for getting all messages related to a UUID?

(From the docs)
/subscribe/{uuid}?token={token}

This is a streaming API that returns device/node messages as they are sent and received. Notice the comma at the end of the response. SkyNet doesn't close the stream.
Note: You can subscribe to UUIDs without knowing the token but this will only allow you to receive broadcast messages from the UUID (devices=* or devices=all)

curl -X GET http://skynet.im/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b?token=123 --header "skynet_auth_uuid: {my uuid}" --header "skynet_auth_token: {my token}"
{"devices":"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc","message":{"red":"on"},"timestamp":1388768270795,"eventCode":300,"_id":"52c6ec0e4f67671e44000001"},{"devices":"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc","message":{"red":"on"},"timestamp":1388768277473,"eventCode":300,"_id":"52c6ec154f67671e44000002"},

Roadmap

Just thinking wouldn't it be nice to have a roadmap of the features planned so contributors can submit pull requests to features.

Error running mqtt-server.js

Hi,

Tried running the broker as
node mqtt-server.js

and keeps coming up with the following error. Any idea how to fix this?

Thanks


Failed to load c++ bson extension, using pure JS version
{"name":"mosca","hostname":"raspberrypi","pid":21357,"level":30,"port":1883,"msg":"server started","time":"2014-06-15T11:26:56.813Z","v":0}
Skynet MQTT server started on port 3000
TypeError: Cannot call method 'toString' of undefined
    at EventEmitter.authenticate (/home/pi/skynet/mqtt-server.js:43:82)
    at Client.handleConnect (/home/pi/skynet/node_modules/mosca/lib/client.js:292:15)
    at MqttServerClient.<anonymous> (/home/pi/skynet/node_modules/mosca/lib/client.js:142:10)
    at MqttServerClient.g (events.js:180:16)
    at MqttServerClient.EventEmitter.emit (events.js:95:17)
    at MqttServerClient.Connection._write (/home/pi/skynet/node_modules/mqtt/lib/connection.js:187:12)
    at doWrite (_stream_writable.js:221:10)
    at writeOrBuffer (_stream_writable.js:211:5)
    at MqttServerClient.Writable.write (_stream_writable.js:180:11)
    at write (_stream_readable.js:583:24)

Issue: Websocket Polling not working

For testing a demo, we had to switch from basic 'websocket' subscription to 'polling' as the preferred subscription method.

This caused an issue on meshblu, with the following error:

Presence offline for socket id:  CTJG-mlNjENh1elJAAAB
getDevice socket info: CTJG-mlNjENh1elJAAAB undefined
sendMessage() from undefined { payload: { online: false }, devices: '*' }
devices: *
message: {"payload":{"online":false},"devices":"*"}

http.js:691
    throw new Error('Can\'t set headers after they are sent.');
          ^
Error: Can't set headers after they are sent.
    at ServerResponse.OutgoingMessage.setHeader (http.js:691:11)
    at Router.find (/home/user/meshblu/meshblu/node_modules/restify/lib/router.js:493:17)
    at Server._route (/home/user/meshblu/meshblu/node_modules/restify/lib/server.js:610:17)
    at routeAndRun (/home/user/meshblu/meshblu/node_modules/restify/lib/server.js:569:14)
    at /home/user/meshblu/meshblu/node_modules/restify/lib/server.js:585:17
    at next (/home/user/meshblu/meshblu/node_modules/restify/lib/server.js:749:22)
    at f (/home/user/meshblu/meshblu/node_modules/restify/node_modules/once/once.js:16:25)
    at Server._sanitizePath (/home/user/meshblu/meshblu/node_modules/restify/lib/plugins/pre/pre_path.js:37:9)
    at next (/home/user/meshblu/meshblu/node_modules/restify/lib/server.js:730:30)
    at f (/home/user/meshblu/meshblu/node_modules/restify/node_modules/once/once.js:16:25)

Maybe, it's necessary to create an additional handler to handle polling requests via websockets, isn't it?

Cheers

No Mongo Indexes

Currently no indexes are installed for any of the Mongo collections. Best practice would be to setup them up on collection creation.

My guess would be to at least index both token and uuid fields for the events collection to ensure fast searches as the collection expands.

Consider registering an IRC channel

As more and more people start to use Skynet everyday, there needs to be some place for folks to discuss openly and for newcomers to seek help in case of a problem.

Registering #skynetim, for instance, on freenode will be a good idea.

Data api doesn't store 0 values

I want to store the amount of available light is currently zero, POSTing to /data a 0 value doesn't work.

$ http POST localhost:3000/data/2e739280-bfec-11e3-a746-6f2838d02e29 token=1adagvblu9639pb9ma8mo7ob1vw019k9 light=0

HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 159
Content-Type: application/json
Date: Fri, 11 Apr 2014 21:36:52 GMT

{
    "_id": "5348607459025ad40e000104",
    "eventCode": 700,
    "ipAddress": "127.0.0.1",
    "timestamp": "2014-04-11T21:36:52.898Z",
    "uuid": "2e739280-bfec-11e3-a746-6f2838d02e29"
}

compared to supplying a value:

$ http POST localhost:3000/data/2e739280-bfec-11e3-a746-6f2838d02e29 token=1adagvblu9639pb9ma8mo7ob1vw019k9 light=1
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 171
Content-Type: application/json
Date: Fri, 11 Apr 2014 21:38:13 GMT

{
    "_id": "534860c559025ad40e000110",
    "eventCode": 700,
    "ipAddress": "127.0.0.1",
    "light": "1",
    "timestamp": "2014-04-11T21:38:13.066Z",
    "uuid": "2e739280-bfec-11e3-a746-6f2838d02e29"
}

No full descriptions of responses to WebSocket calls

There is an example of using the Websock API but it does not explain what each request can expect in the callback. The REST API has some of this information but the API is different in some places (e.g. WS: use "register" to register a device; REST: post to "/devices"). Through experiments I found that a WS call to "register" returns a token, eventCode number, device string, channel, a few other things.

Perhaps all this can be derived by digging through every example but having a single place listing calls and the possible responses would be helpful.

/devices resource returns a 200 even when it means a 404

Right now, if I make a call to /devices and there are none in the system, I get this:

{
   "errors":[
      {
         "message":"Devices not found",
         "code":404
      }
   ],
   "timestamp":1390250790811,
   "eventCode":403,
   "_id":"52dd8b266510d36bc4000009"
}

But the HTTP status code returned is 200. Really, the HTTP status code should be set to 404 an then embedding the code in the errors array would not be necessary, and you could just have a message field.

uuid and token not being pulled from data on POST to /devices

Steps to reproduce:

  1. Create a new object using http endpoint:
→ curl -X POST http://skynet.im/devices --data "uuid=24bbe944-9b92-4cea-bd17-2361fb88ff50&token=b9a964a0-f3b9-4974-b2ad-024dae549f5e" --header "skynet_auth_uuid: 24bbe944-9b92-4cea-bd17-2361fb88ff50" --header "skynet_auth_token: b9a964a0-f3b9-4974-b2ad-024dae549f5e" 

Results in:

{"uuid":"24bbe944-9b92-4cea-bd17-2361fb88ff50","token":"b9a964a0-f3b9-4974-b2ad-024dae549f5e","ipAddress":"173.8.157.38","timestamp":"2014-06-12T21:22:29.520Z","channel":"main","online":false}

Device is created with the specified uuid and token (good)

  1. Delete the device
→ curl -X DELETE https://skynet.im/devices/79897b50-f277-11e3-ba2e-0b078550b2fe --header "skynet_auth_uuid: 79897b50-f277-11e3-ba2e-0b078550b2fe" --header "skynet_auth_token: 000ngc9b6i1jpgmn29vniyk5f0d1v2t9"
  1. Create a new object using https endpoint:
→ curl -X POST https://skynet.im/devices --data "uuid=24bbe944-9b92-4cea-bd17-2361fb88ff50&token=b9a964a0-f3b9-4974-b2ad-024dae549f5e" --header "skynet_auth_uuid: 24bbe944-9b92-4cea-bd17-2361fb88ff50" --header "skynet_auth_token: b9a964a0-f3b9-4974-b2ad-024dae549f5e"

Results in:

{"ipAddress":"173.8.157.38","uuid":"79897b50-f277-11e3-ba2e-0b078550b2fe","timestamp":"2014-06-12T21:21:10.532Z","token":"000ngc9b6i1jpgmn29vniyk5f0d1v2t9","channel":"main","online":false}%

Device is created a newly generated uuid and token.. this is bad :(

Parent connections only work one way?

I'm trying to set up a local meshblu (child) and be able to exchange messages with meshblu.octoblu.com (parent).

I can send messages from meshblu.octoblu.com to the local meshblu (parent to child), but there doesn't seem to be a mechanism to send messages the other way (child to parent).

Looking through the code, it looks like commit 4565fe8 by @monteslu added the mechanism to forward messages sent to unknown device UUIDs to the parent.

A few weeks later, commit 4caea0d removed the forwarding mechanism, as part of the mongodb scaling changes.

Was this deliberate?

Transport unknown

My code for connecting to skynet, not changed in quite some time, stopped working. I'm getting the error 'connect': {"code":0,"message":"Transport unknown"} (RuntimeError). This is in Ruby.

Octoblue - unable to create an account

Hi,

On the main page of github for skynet it says
"You can run your NodeBlu flows on our servers 24/7 by signing up for an Octoblu account today!"

When I click on link, Octoblu site loads and the dashboard briefly appears on the left and then goes straight to the flash demo. The dashboard disappears and cannot find a link to sign up.

Anyone managed to create an account?

Thanks

Subscriptions are not working (with NeDB)

Hi,

i'm having some issues with the subscription REST-API. I've created some devices and i want to subscribe to one specific device. My curl Call is the following:

curl -X GET "http://localhost:3000/subscribe/0cbd6501-1bca-11e4-834e-331a925ae32b" --header "skynet_auth_uuid: d60670c1-1bbe-11e4-834e-331a925ae32b" --header "skynet_auth_token: 06i10tq9lu7x8ncdixm6uqp0oqykqpvi"

The response from meshblu is:
{"code":"InternalError","message":"Object # has no method 'pipe'"} .

Currently, i'm not able to use subscriptions anyway. Websocket are also not working -> Response: timeout.

But the subscriptions should work as the Demo on skynet.im is using subscriptions and working fine.

Any ideas?

=============EDIT====================================================

My first "investigations" are showing that there is an issue with using .pipe() method in "setupHttpRoutes.js". The db-query returns a Cursor-Object (subscribe.js) and this object has only the following structure:

-Cursor
-- db: Datastore
--- autoload: true
--- executor: Executor
--- filename: "..."
--- inMemoryOnly: false
--- indexes: Object
--- persistence: Persistence
-- execFn: function (err, docs, callback) {
-- query: Object
--- $or: Array[2]
--- timestamp: Object

As you can see, the call "subscribe(req.params.uuid).pipe(foo)" in setupHttpRoutes.js is not possible since there is no such function returned.

Will try to use mongodb, maybe they are returning something

FR: Encrypted messages

I've been looking into several solutions for other projects but this would be a great addition. It could be something as simple as encrypting JSON with JWT or even OAuth. The major challenge of course is that many IoT devices lack the processing power and/or dedicated hardware for even basic cryptography.

The right solution is probably complex with multiple levels of security.

API calls in skynet reference

The only reference available currently on the skynet api reference is the api calls and their functions.

There should be some sort of step by step guide to api calls in the reference page to ease the understanding.

For instance something like this would be good:

  1. Make a call to status to make sure the server is online.
  2. Register your device on skynet using the devices call.
  3. Listen on skynet messages using the subscribe call.
  4. Send a message to the device using the messages call.

NodeBlue Skynet hub

I am trying to connect my hue lights

msg.subdevice = 'M_Room_Lights2';
msg.payload = {
setState: {lightNumber: 1, on: false}

};
return msg;

but in /home/pi/hub/hub.log on my raspberryPi I found an error:

message received from: xxxx-UUID-NodeBlu-xxxx
matching subdevice found: M_Room_Lights2
messenger send { devices: 'xxxx-UUID-NodeBlu-xxxx',
message: [ { error: [Object] } ] } undefined

What's wrong?
On my raspberryPi I have only installed skynet hub

Raspberry Pi help getting started

Hi, I have skynet.im and also skynet hub installed on my raspberry pi. Having a little difficulty on how to get my home automation talking to each other.

I have a usb tellstick attached to the Pi and 4 power sockets around the house. To turn on socket 1, I need to issue the following command:

tdtool --on 1

Please could someone give some advice/walk-through on how and where to get started. It would be much appreciated.

Thanks

Use Primus or Primus.io for websocket transport

@chrismatthieu I love your project, congratulations for always having these great ideas on and for the web.

Have you thought on using primus (for lower level) or primus.io (for higher level like socket.io type) so you can use your own transport (transformer) ws, engine.io, socket.io, browserchannel, sock.js I find this being very beneficial for developers, what do you think?

Server does not start - issue with socket.io-redis

The first error was that socket.io did not find node_modules_redis - moved to this dir npm install redis ok, after that I got the error (See at the end).
I used also npm install socket.io-redis - did not help because in skynet/lib/redis.js seems to be some wrong code, including scripts from socket.io subdir. Why not require ('redis')?

var redis = require('socket.io/node_modules/redis');
var RedisStore = require('socket.io/lib/stores/redis');

In any case I would appreciate any help to get the missing files, as npm install as described don't work.

node server.js 

module.js:340
    throw err;
          ^
Error: Cannot find module 'socket.io/lib/stores/redis'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Volumes/HDD/projects/iot/skynet/lib/redis.js:2:18)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

NodeBlu - Voice tts only outputs 1st time when text is same

I did 2 injects. First with a payload of On and second as Off. Then a switch and then a function comparison and then speech and debug.

When you click the inject for On, it speaks "on" and debug outputs on. Also works for off but if you run "on" and then "on" again, the second on does not speak but does output to the debug window. Same when you inject "off" twice.

thanks

Decentralization

Would it be possible to decentralize the core server of skynet to allow the network to work much like the Bitcoin blockchain?

In BitCoin, you have a bunch of known, trusted, nodes. Any client is both a server and a client, it can connect to any given node that knows about other nodes, receive a list of other nodes, and connect to them, and so on. This allows a decentralized network of computers all communicating with each other to exchange new nodes in the network.

It would be great to implement this in SkyNet to decentralize the server to all of the clients - so that any given client could connect to any other client and immediately know about all of the other Things in the network.

Security / Point to Point Communication

Perhaps I misunderstand the goal of this project - but I was thinking, one necessary feature would be to introduce peer to peer communications. For example, of one device wanted to talk directly to another, it could communicate directly with that device without others being able to listen in. Of course you could implement some sort of key exchange to set up encryption and simply allow anyone to watch the stream of data, given the key exchange has occurred already.

Changes in Skynet Socket API?

My project was working fine a few days ago. I started working on it today and noticed a new error in the console:

GET http://skynet.im:3000/socket.io/?EIO=2&transport=polling&t=1404824663344-8 net::ERR_CONNECTION_REFUSED socket.io.js:2815

Has the Skynet socket API changed recently? I couldn't see a version in the skynet.js file, but the MD5 is a02f460d437d44e12499cc8846cfbdd0 versus the one available on the Skynet homepage, which is c6c83d1706a96d0d95b6b26d827f75a7

Errors during build (npm install)

zeromq version used in code is old and breaks the build.

make: Entering directory `/home/abhay/meshblu/node_modules/mosca/node_modules/zm
q/build'
  CXX(target) Release/obj.target/zmq/binding.o
../binding.cc: In static member function ‘static void zmq::Socket::UV_MonitorCallback(uv_idle_t*, int)’:
../binding.cc:385:9: error: ‘zmq_event_t’ was not declared in this scope
../binding.cc:385:21: error: expected ‘;’ before ‘event’
../binding.cc:389:18: error: ‘event’ was not declared in this scope
make: *** [Release/obj.target/zmq/binding.o] Error 1
make: Leaving directory `/home/abhay/meshblu/node_modules/mosca/node_modules/zmq/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_
modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:810:
12)
gyp ERR! System Linux 3.10.23-xxxx-std-ipv6-64
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/b
in/node-gyp.js" "rebuild"
gyp ERR! cwd /home/abhay/meshblu/node_modules/mosca/node_modules/zmqgyp ERR! node -v v0.10.32
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! [email protected] install: `node-gyp rebuild`npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the zmq package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls zmq
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.10.23-xxxx-std-ipv6-64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "rebuild"
npm ERR! cwd /home/abhay/meshblu                             
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/abhay/meshblu/npm-debug.log
npm ERR! not ok code 0

Is self-signed certificate work?

I tried to add device to SkyNet with HTTPS protocol and I found a problem.

  • When I POST to SkyNet to register a new device with HTTP protocol, everything look great.
  • Then I add another device with HTTPS protocol, only standard metadata is saved, no other custom properties.

BTW. I didn't use default config.js yet (the one use environment params) Not sure it's cause of problem or not. The config.js is locate below this post. And the version I testing is 12df854.

module.exports = {
port: 3000,
tls: {
sslPort: 443,
cert: "/certs/server.crt",
key: "/certs/server.key"
},
log: true,
mongo: {
databaseUrl: "mongodb://localhost:27017/skynet"
},
redis: {
host: "127.0.0.1",
port: "6379",
password: "pass@word1"
},
rateLimits: {
message: 10,
data: 10,
connection: 2,
query: 2,
whoami: 10,
unthrottledIps: ["54.186.134.252"]
},
plivo: {
authId: "abc",
authToken: "123"
},
urbanAirship: {
key: "abc",
secret: "123"
},
coap: {
port: 5683,
host: "localhost"
},
mqtt: {
databaseUrl: "mongodb://user:[email protected]:1337/skynet",
port: 1883,
skynetPass: "Very big random password 34lkj23orfjvi3-94ufpvuha4wuef-a09v4ji0rhgouj"
}
};

Consider integration/parity with TheThingSystem, to ease discovery of new devices

https://github.com/TheThingSystem/steward is a project with very similar goals; nodejs based, at least in terms of discovery and enabling status/indicators to share information.

I believe there's some MQTT support in TTS, and it'd be interesting to see where the two projects can play off of each other's strengths.

A simple first step could be treating a TTS steward instance as an external directory of devices; or recognizing Stewards device A is Skynet.im's device B.

More tutorials and walk throughs

A lot of people will love to use Skynet on their Arduinos, Raspberri Pis, and other embedded platforms, but unfortunately the lack of tutorials to implement and use Skynet keeps them from doing it.

Consider adding some tutorials on skynet.im or Github pages as a reference for people.

GET calls to /data/ hang

The following never returns, it just hangs.

curl -X GET http://pb:3000/data/f65ea8e0-ab7c-11e3-b66c-575bfd455815/?token=zrfwb2jf2113jtt9791fhhbjan1rwwmi

There is nothing in the server logs on the host pb. POSTing data is fine, just can't get it back out.

JavaSacript demo

Hi, Chirs,
I'm trying to use the trick about the "socket open", using the Websocket API. But I have this messages:
image

Could you said me what I'm doing wrong?

Thanks in advance :)

Device not registered', code: 500

Hi, Trying to run on a Raspberry Pi. The following seems to start OK

~/skynet $ node server.js
info - socket.io started
Skynet connected to MQTT broker
No MQTT server found.

SSSSS kk tt
SS kk kk yy yy nn nnn eee tt
SSSSS kkkkk yy yy nnn nn ee e tttt
SS kk kk yyyyyy nn nn eeeee tt
SSSSS kk kk yy nn nn eeeee tttt
yyyyy

Skynet development environment loaded...
coap listening at coap://raspberrypi:5683
restify listening at http://0.0.0.0:3000

Then run curl -X GET http://raspberrypi:3000/status
and response is

{ skynet: 'online' }

Then try to register
curl -X POST -d "type=drone&color=black" http://raspberrypi:3000/devices
and response is

register { type: 'drone', color: 'black', ipAddress: '127.0.0.1' }
register { error: { message: 'Device not registered', code: 500 } }

If I run

curl -X POST -d "type=drone&color=black" http://skynet.im/devices

it does come back with a uuid and token. Just cant seem to get it to work on my Pi.

Thanks

TypeError: Cannot call method 'toString' of undefined when POSTing to /data/

Skynet development environment loaded...
Skynet listening at http://0.0.0.0:3000
Sensor data logged: {"timestamp":"2014-03-25T08:52:14.549Z","uuid":"f65ea8e0-ab7c-11e3-b66c-575bfd455815","temperature":"22.16","pressure":"1005.65","light":"2283","humidity":"99.9","backdoor":"1","online":"true","ipAddress":"192.168.0.201","_id":"533143be5e1b0b3d63000001"}
[TypeError: Cannot call method 'toString' of undefined]
{ timestamp: '2014-03-25T08:52:14.549Z',
  uuid: 'f65ea8e0-ab7c-11e3-b66c-575bfd455815',
  temperature: '22.16',
  pressure: '1005.65',
  light: '2283',
  humidity: '99.9',
  backdoor: '1',
  online: 'true',
  ipAddress: '192.168.0.201',
  eventCode: 700,
  _id: 533143be5e1b0b3d63000002 }
Event Loggged: {"timestamp":"2014-03-25T08:52:14.549Z","uuid":"f65ea8e0-ab7c-11e3-b66c-575bfd455815","temperature":"22.16","pressure":"1005.65","light":"2283","humidity":"99.9","backdoor":"1","online":"true","ipAddress":"192.168.0.201","eventCode":700,"_id":"533143be5e1b0b3d63000002"}
Log file updated
{ _index: 'log',
  _type: '700',
  _id: 'NLct1AZpSgS8h6mbhfQ_Bw',
  _version: 1,
  created: true }
logged to elastic search

Think it's https://github.com/skynetim/skynet/blob/master/lib/logData.js#L17 not sure what in my payload would break it.

Calling PUT on /devices/:id does not appear to update database

I created a test object in the database, then tried to update it. The call appears to succeed, however subsequent calls did not appear to persist the data. Here is my command line:

$ curl -X PUT -d "awesome=sauce" http://localhost:3000/devices/18676eb1-9997-11e3-8c2a-f18a07a72684
{"uuid":"18676eb1-9997-11e3-8c2a-f18a07a72684","awesome":"sauce","timestamp":1392839514415,"eventCode":401,"_id":"53050b5ae17ed4012e00000f"}
$ curl -X GET http://localhost:3000/devices/18676eb1-9997-11e3-8c2a-f18a07a72684
{"_id":"5304fd9d71d92a5025000001","channel":"main","color":"black","online":true,"socketId":"X3vYDIdBC5xGf_vOoAbV","timestamp":1392838789634,"type":"drone","uuid":"18676eb1-9997-11e3-8c2a-f18a07a72684","eventCode":500

Looking at my local skynet log, it would appear no errors occurred, even tho the data was not saved:

Device udpated: {"uuid":"18676eb1-9997-11e3-8c2a-f18a07a72684","awesome":"sauce","timestamp":1392839514415}
{ uuid: '18676eb1-9997-11e3-8c2a-f18a07a72684',
  awesome: 'sauce',
  timestamp: 1392839514415,
  eventCode: 401,
  _id: 53050b5ae17ed4012e00000f }
Event Loggged: {"uuid":"18676eb1-9997-11e3-8c2a-f18a07a72684","awesome":"sauce","timestamp":1392839514415,"eventCode":401,"_id":"53050b5ae17ed4012e00000f"}
Log file udpated
   debug - emitting heartbeat for client X3vYDIdBC5xGf_vOoAbV
   debug - websocket writing 2::
   debug - set heartbeat timeout for client X3vYDIdBC5xGf_vOoAbV
   debug - got heartbeat packet
   debug - cleared heartbeat timeout for client X3vYDIdBC5xGf_vOoAbV
   debug - set heartbeat interval for client X3vYDIdBC5xGf_vOoAbV
18676eb1-9997-11e3-8c2a-f18a07a72684
Device whoami: {"_id":"5304fd9d71d92a5025000001","channel":"main","color":"black","online":true,"socketId":"X3vYDIdBC5xGf_vOoAbV","timestamp":1392838789634,"type":"drone","uuid":"18676eb1-9997-11e3-8c2a-f18a07a72684"}
{ _id: 5304fd9d71d92a5025000001,
  channel: 'main',
  color: 'black',
  online: true,
  socketId: 'X3vYDIdBC5xGf_vOoAbV',
  timestamp: 1392838789634,
  type: 'drone',
  uuid: '18676eb1-9997-11e3-8c2a-f18a07a72684',
  eventCode: 500 }
Event Loggged: {"_id":"5304fd9d71d92a5025000001","channel":"main","color":"black","online":true,"socketId":"X3vYDIdBC5xGf_vOoAbV","timestamp":1392838789634,"type":"drone","uuid":"18676eb1-9997-11e3-8c2a-f18a07a72684","eventCode":500}
Log file udpated

Any thoughts?

Deployment in Heroku

Hi,
I try to deploy skynet in heroku , I install Mongo DB and redis, I update de config file and deploy but when I try to run the app , the app crash, and this message appear:

at=error code=H10 desc="App crashed" method=GET path=/ host=sycconet.herokuapp.com request_id=3d259ca6-d52e-4ac8-a894-144846c46b1f fwd="63.70.73.50" dyno= connect= service= status=503 bytes=

Do you know what is the problem??

FR: explore P2P communication

The cloud is also about Machine to Machine (M2M) communication. P2P makes a lot of sense especially with a room full of sensors since it reduces latency. That also means communication still works when the cloud is unavailable. CoAP (#6) supports multicast, so that might be an option.

One interesting idea this could lead to would be offline/local registration. There could be a distributed confirmation system, similar to how bitcoins work.

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.