forked from octoblu/meshblu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1848 lines (1547 loc) · 73.7 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<!--[if IE 8]> <html class="no-js lt-ie9 ie8" lang="en"> <![endif]-->
<!--[if IE 9]> <html class="ie9" lang="en"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<title>SkyNet - Machine-to-machine instant messaging (M2M IM) open communications platform & API for the internet of things.</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- LESS styles -->
<!-- <link rel="stylesheet/less" type="text/css" href="css/less/custom.less" />
<link rel="stylesheet/less" type="text/css" href="css/less/bootstrap/responsive.less" /> -->
<!-- Main styles -->
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/custom.css" >
<link rel="stylesheet" href="css/responsive.css">
<!-- Custom styles -->
<link rel="stylesheet" href="css/fonts.css">
<link rel="stylesheet" href="css/magnific-popup.css">
<link rel="stylesheet" href="css/jquery.bxslider.css">
<link rel="stylesheet" href="css/animate.css">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<![endif]-->
<!--[if gte IE 9]>
<style type="text/css">
.gradient {
filter: none;
}
</style>
<![endif]-->
<!-- Web fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:300,400,700' rel='stylesheet' type='text/css'>
<!-- Fav and touch icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png">
<link rel="shortcut icon" href="ico/favicon.png">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
<body>
<header class="clearfix">
<div class="span3 logo featured">
<h1>
<a href="#home"><span>SKYNET</span>.im</a>
<!-- <a href="#home">Meshines</a> -->
</h1>
</div>
<a href="https://github.com/skynetim/skynet"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
<!-- <div class="span3 pull-right header-cta">
<a href="#contact-form" class="modal-form contact btn cta pull-right">Get in touch</a>
</div>
-->
</header>
<div class="wrapper">
<nav class="sidenav">
<ul>
<li class="current"><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#projects">Screencasts</a></li>
<li><a href="#restapi">REST API</a></li>
<!-- <li><a href="#websockets">Websocket API</a></li> -->
<li><a href="#examples">Examples</a></li>
<li><a href="#demo">Demo</a></li>
<li><a href="#footer-cta">Contact</a></li>
</ul>
</nav>
<section id="home" class="text-center freelancer">
<div class="helper"></div>
<div class="hero-content">
<!-- <h1>I AM A <span>DESIGNER</span> / <span>DEVELOPER</span><br />living in Paris.</h1> -->
<!-- <h1>REALTIME <span>IOT</span> NETWORK & <span>API</span></h1> -->
<!-- <h1><span>Machine-to-machine</span> <br/>instant messaging</h1> -->
<!-- <a href="#about" class="btn btn-large scroll assimilate">Assimilate!</a> -->
</div>
</section>
<section id="about">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>Open communications network & API for the <span class="underline">Internet of Things</span>.</h1>
</div>
<div class="feature col-md-4">
<div aria-hidden="true" class="icon icon-cloudy-2"></div>
<h3>MQTT & CoAP NETWORK</h3>
<p class="hidden-phone">SkyNet is a cloud-based MQTT & CoAP-powered network that scales to meet any needs whether the nodes are smart devices, sensors, cloud resources, drones, Arduinos, Raspberry Pis, etc.</p>
</div>
<div class="feature col-md-4">
<a href="#api"><div aria-hidden="true" class="icon icon-cog-2"></div></a>
<h3>REST & WEBSOCKET API</h3>
<p class="hidden-phone">SkyNet is powered by Node.JS and based entirely on its integrated REST API and realtime RPC-style Websocket API with extensible JSON device & messaging.</p>
</div>
<div class="feature col-md-4">
<div aria-hidden="true" class="icon icon-hdd"></div>
<h3>DEVICE DIRECTORY</h3>
<p class="hidden-phone">SkyNet provides a queriable device directory API for registering and discovering nodes on the SkyNet network. SkyNet also maintains presence for each device making it easy to know what is on/offline.</p>
</div>
</div>
<div class="row">
<div class="feature col-md-4">
<div aria-hidden="true" class="icon icon-lock"></div>
<h3>DEVICE SECURITY</h3>
<p class="hidden-phone">SkyNet issues a unique 36 character UUID and secret token for each device connecting to our network. These device "credentials" are required for authentication, API calls, and subscriptions.</p>
</div>
<div class="feature col-md-4">
<div aria-hidden="true" class="icon icon-asterisk"></div>
<h3>SKYNET HUB</h3>
<p class="hidden-phone">Our <a href="https://github.com/skynetim/hub">SkyNet Hub</a> allows you to connect smart devices with IP addresses and not-so-smart devices without IP addresses to SkyNet via our software-based hub which supports Mac, Linux, & Windows.</p>
</div>
<div class="feature col-md-4">
<div aria-hidden="true" ><br /><br /><a href="https://github.com/skynetim/skynet_firmware_arduino"><img src="/img/arduino.png" height="60"></a></div><br />
<h3>SKYNET OS</h3>
<p class="hidden-phone">Our <a href="https://github.com/skynetim/skynet_firmware_arduino">SkyNet OS</a> connects your Arduino to SkyNet and awaits Firmata commands to retrieve sensor data or send/remove voltage to/from pins. </p>
</div>
</div>
<div class="row">
<div class="feature col-md-4">
<div aria-hidden="true" ><br /><br /><a href="http://npmjs.org/skynet"><img src="/img/npm.png" width="150px"/></a></div><br />
<h3>NODE.JS NPM MODULE</h3>
<p class="hidden-phone">Node.JS is known for fast, event-driven operations perfect for nodes and devices such as RaspberryPi, Arduino, and Tessel. Our NPM module gets your app up & running quickly!</p>
</div>
<div class="feature col-md-4">
<a href="#javascript"><div aria-hidden="true" class="icon icon-code"></div></a>
<h3>JAVASCRIPT</h3>
<p class="hidden-phone">Connect to SkyNet from a web browser or mobile device using our <a href="#javascript">SkyNet.JS</a> javascript include file!</p>
</div>
<div class="feature col-md-4">
<div aria-hidden="true" ><br /><br /><a href="http://www.controlaltdieliet.be/blog/?p=343"><img src="/img/python_logo.png" width="50" height="50"></a></div><br />
<h3>PYTHON</h3>
<p class="hidden-phone">Connect to SkyNet from any Python application using realtime Websockets.</p>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h3>SkyNet allows you to query devices such as drones, hue light bulbs, weemos, arduinos, and server nodes that meet your criteria and send IM messages to 1 or all devices.</h3>
<h3>You can also subscribe to messages being sent to/from devices and their sensor activities.</h3>
</div>
</div>
</div>
</section>
<a name="videos"></a>
<section id="projects">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>SkyNet in Action</h1>
</div>
<div class="col-md-12 featured-image">
<ul class="featuredSlider">
<li>
<p class="animated bounceInDown">Dancing Drones Controlled by SkyNet</p>
<!-- <img src="img/features-img1.png" id="fi-1" class="animated bounceInUp" alt="" /> -->
<iframe width="960" height="720" src="//www.youtube.com/embed/CCr17B1gSPw" frameborder="0" allowfullscreen class="animated bounceInUp"></iframe>
</li>
<li>
<p class="animated bounceInDown">Behind the Scenes: Drones + LeapMotion + SkyNet</p>
<iframe width="960" height="720" src="//www.youtube.com/embed/4iJYeK6wFBs" frameborder="0" allowfullscreen class="animated bounceInUp"></iframe>
</li>
<li>
<p class="animated bounceInDown">SkyNet API Speaks HTTP, WebSockets, & MQTT</p>
<iframe width="960" height="720" src="//www.youtube.com/embed/iFEQqlXn4ZM" frameborder="0" allowfullscreen class="animated bounceInUp"></iframe>
</li>
<li>
<p class="animated bounceInDown">Controlling a Phillips Hue with SkyNet</p>
<iframe width="960" height="720" src="//www.youtube.com/embed/LcjVxy_lKSI" frameborder="0" allowfullscreen class="animated bounceInUp"></iframe>
</li>
<li>
<p class="animated bounceInDown">Connect & Control RaspberryPi with SkyNet</p>
<iframe width="960" height="720" src="//www.youtube.com/embed/4w2gnt_5A4g" frameborder="0" allowfullscreen class="animated bounceInUp"></iframe>
</li>
<li>
<p class="animated bounceInDown">Connecting Arduino to Chrome & SkyNet Client-side</p>
<iframe width="960" height="720" src="//www.youtube.com/embed/QTtN3WQlhQQ" frameborder="0" allowfullscreen class="animated bounceInUp"></iframe>
</li>
<li>
<p class="animated bounceInDown">Connecting an App to Device & SkyNet</p>
<iframe width="960" height="720" src="//www.youtube.com/embed/ZXViFSBL324" frameborder="0" allowfullscreen class="animated bounceInUp"></iframe>
</li>
</ul>
</div>
</div>
</div>
</section>
<a name="nodeblu"></a>
<section id="projects">
<div class="container">
<div class="row">
<div class="col-md-12">
<!-- <h1>NodeBlu</h1> -->
<p class="animated bounceInDown">Experiment with SkyNet using our NodeBlu Chrome App!</p>
</div>
<div class="col-md-12 featured-image">
<a href="https://chrome.google.com/webstore/detail/nodeblu/aanmmiaepnlibdlobmbhmfemjioahilm"><img src="/img/nodeblu.png" width="100%"></a>
</div>
</div>
</div>
</section>
<a name="api"></a>
<div class="bs-example bs-example-tabs">
<section id="restapi">
<div class="container">
<div class="row">
<ul id="myTab" class="nav nav-tabs">
<li class="active"><a href="#rest_api" data-toggle="tab">HTTP REST API</a></li>
<li><a href="#websocket_api" data-toggle="tab">WebSockets API</a></li>
<li><a href="#javascript_api" data-toggle="tab">Javascript API</a></li>
<li><a href="#coap_api" data-toggle="tab">CoAP API</a></li>
<li><a href="#mqtt_api" data-toggle="tab">MQTT API</a></li>
</ul>
</div>
</div>
</section>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="rest_api">
<section id="restapi">
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<h1>HTTP(S) REST API</h1>
</div>
<div class="col-md-12">
<h1>Base URI: http(s)://skynet.im</h1>
</div>
<div class="col-md-12">
<h2>Most of our API endpoints require authentication credentials (UUID and secret token) passed in the HTTP headers as <u>skynet_auth_uuid</u> and <u>skynet_auth_token</u> respectively. These credentials are generated by registering a device or user with SkyNet via the POST /Devices API (see below). If you would like to associate additional SkyNet devices to the UUID and Token that you created (as a user), you can add an "owner" property to your other devices with the user's UUID as its value. </h2>
<h2>We support the following device permissions: View/Discover, Send Messages, and Configure. These permissions are manageable by adding UUIDs to whitelists and blacklists arrays with the following names: viewWhitelist, viewBlacklist, sendWhitelist, sendBlacklist, updateWhitelist, updateBlacklist. Note: If your UUID is the same as the "owner" UUID, these permissions are not enforced (you are the owner). </h2><br />
</div>
<div class="col-md-12">
<h1>Status</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/status</b>
<br />Returns the SkyNet platform status
<br />
<pre>curl -X GET http://skynet.im/status</pre> <pre>{"skynet":"online","timestamp":1381536589633,"eventCode":200,"_id":"5258934d56330f7dd0000009"}</pre>
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<h1>Devices</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-success" disabled> POST</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/devices</b><br />
<b>Payload: key=value (i.e. type=drone&color=black)</b>
<br />Registers a node or device with SkyNet. SkyNet returns a UUID device id and security token. You can pass any key/value pairs and even override SkyNet's auto-generated UUID and/or token by passing your own uuid and/or token in the payload i.e. uuid=123&token=456
<br />
<b> Be sure to make note of your <strong>uuid</strong> and <strong>token</strong> as other calls require you to use these as a security check</b>
<pre>curl -X POST -d "type=drone&color=black" http://skynet.im/devices</pre>
<pre>{"type":"drone","color":"black","uuid":"6f72bc60-32d5-11e3-92e2-e94f95fc16a6","timestamp":1381537803046,"token":"4bbd2jm242dl5wmimbwz4rvlu77m0a4i","channel":"main","online":false,"_id":"5258980b56330f7dd000000d"}</pre>
<br />
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/devices?key=value&key=value</b>
<br />Returns an array of device UUIDs based on key/value query criteria
<br />
<pre>curl -X GET http://skynet.im/devices?type=drone --header "skynet_auth_uuid: {my uuid}" --header "skynet_auth_token: {my token}"</pre>
<pre>{"devices":["ad698900-2546-11e3-87fb-c560cb0ca47b","2f3113d0-2796-11e3-95ef-e3081976e170"]}</pre>
<br />
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/devices/{uuid}</b>
<br />Returns all information (except the token) of a specific device or node
<br />
<pre>curl -X GET http://skynet.im/devices/ad698900-2546-11e3-87fb-c560cb0ca47b --header "skynet_auth_uuid: {my uuid}" --header "skynet_auth_token: {my token}"</pre>
<pre>{"_id":"5241d9140345450000000001","api":"update","armed":true,"channel":"main","deviceDescription":"this is a test","deviceName":"hackboard","key":"777","online":true,"socketid":"fO8dxKEwARUH9Ea--p2C","timestamp":1381536277933,"uuid":"ad698900-2546-11e3-87fb-c560cb0ca47b"}</pre>
<br />
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-warning" disabled> PUT</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/devices/{uuid}</b><br />
<b>Payload: key=value (i.e. type=drone&color=blue&online=true)</b>
<br />Updates a node or device currently registered with SkyNet that you have access to update. You can pass any key/value pairs to update object as well as null to remove a propery (i.e. color=null).
<br />
<pre>curl -X PUT -d "color=blue&online=true" http://skynet.im/devices/ad698900-2546-11e3-87fb-c560cb0ca47b --header "skynet_auth_uuid: {my uuid}" --header "skynet_auth_token: {my token}"</pre>
<pre>{"uuid":"ad698900-2546-11e3-87fb-c560cb0ca47b","color":"blue","timestamp":1381537750462}</pre>
<br />
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-danger" disabled> DELETE</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/devices/{uuid}</b><br />
<br />Deletes or unregisters a node or device currently registered with SkyNet that you have access to update.
<br />
<pre>curl -X DELETE http://skynet.im/devices/ad698900-2546-11e3-87fb-c560cb0ca47b --header "skynet_auth_uuid: {my uuid}" --header "skynet_auth_token: {my token}"</pre>
<pre>{"uuid":"ad698900-2546-11e3-87fb-c560cb0ca47b","timestamp":1381537971074}</pre>
<br />
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<h1>myDevices</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/mydevices</b>
<br />Returns all information (including tokens) of all devices or nodes belonging to a user's UUID (identified with an "owner" property and user's UUID i.e. "owner":"0d1234a0-1234-11e3-b09c-1234e847b2cc")
<br />
<pre>curl -X GET http://skynet.im/mydevices --header "skynet_auth_uuid: {my uuid}" --header "skynet_auth_token: {my token}"</pre>
<pre>{"devices":[{"owner":"0d1234a0-1234-11e3-b09c-1234e847b2cc","name":"SMS","phoneNumber":"16025551234","uuid":"1c1234e1-xxxx-11e3-1234-671234c01234","timestamp":1390861609070,"token":"1234eg1234zz1tt1234w0op12346bt9","channel":"main","online":false,"_id":"52e6d1234980420c4a0001db"}}]}</pre>
<br />
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<h1>Messages</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-success" disabled> POST</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/messages</b>
<br />Send a message to a specific device, array of devices, or all devices subscribing to a UUID on the SkyNet platform
<br />
<pre>curl -X POST -d '{"devices": "*", "payload": {"yellow":"off"}}' http://skynet.im/messages --header "skynet_auth_uuid: {my uuid}" --header "skynet_auth_token: {my token}"</pre>
<pre>curl -X POST -d '{"devices": ["ad6...47b","2f3...170"], "payload": {"yellow":"off"}}' http://skynet.im/messages --header "skynet_auth_uuid: {my uuid}" --header "skynet_auth_token: {my token}"</pre>
<pre>curl -X POST -d '{"devices": "ad698900-2546-11e3-87fb-c560cb0ca47b", "payload": {"yellow":"off"}}' http://skynet.im/messages --header "skynet_auth_uuid: {my uuid}" --header "skynet_auth_token: {my token}"</pre>
<pre>{"devices":"*","payload":{"yellow":"off"}}</pre>
<!-- <pre>{"devices":"all","message":{"yellow":"off"}</pre> -->
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<h1>Events</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/events/{uuid}</b>
<br />Returns last 10 events related to a specific device or node
<br />
<pre>curl -X GET http://skynet.im/events/ad698900-2546-11e3-87fb-c560cb0ca47b --header "skynet_auth_uuid: {my uuid}" --header "skynet_auth_token: {my token}"</pre>
<pre>{"events":[{"uuid":"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc","socketid":"lnHHS06ijWUXEzb01ZRy","timestamp":1382632438785,"eventCode":101,"_id":"52694bf6ad11379eec00003f"},{"uuid":"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc","socketid":"BuwnWQ_oLmpk5R3m1ZRv","timestamp":1382561240563,"eventCode":101,"_id":"526835d8ad11379eec000017"}]}</pre>
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<h1>Subscribe</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/subscribe/{uuid}?token={token}</b>
<br />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.
<br />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)
<br />
<pre>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}"</pre>
<pre>{"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"},</pre>
</div>
</td></tr></table>
</div>
<!--
<div class="col-md-12">
<h1>Authenticate</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/authenticate/{uuid}?token={token}</b>
<br />Returns UUID and authticate: true or false based on the validity of uuid/token credentials
<br />
<pre>curl -X GET http://skynet.im/authenticate/81246e80-29fd-11e3-9468-e5f892df566b?token=5ypy4rurayktke29ypbi30kcw5ovfgvi</pre>
<br />
<pre>{"uuid":"81246e80-29fd-11e3-9468-e5f892df566b","authentication":true} OR {"uuid":"81246e80-29fd-11e3-9468-e5f892df566b","authentication":false}</pre>
</div>
</td></tr></table>
</div>
-->
<div class="col-md-12">
<h1>IP Address</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/ipaddress</b>
<br />Returns the public IP address of the request. This is useful when working with the SkyNet Gateway behind a firewall.
<br />
<pre>curl -X GET http://skynet.im/ipaddress</pre>
<pre>{"ipAddress":"70.171.149.205"}</pre>
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<h1>Data</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-success" disabled> POST</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/data/{uuid}</b><br />
<b>Payload: key=value&key2=value2 (i.e. temperature=78&humity=30)</b>
<br />Stores sensor data for a particular UUID. You can pass any key/value pairs.
<br />
<pre>curl -X POST -d "wind=12&temperature=78" http://skynet.im/data/0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc --header "skynet_auth_uuid: {my uuid}" --header "skynet_auth_token: {my token}"</pre>
<pre>{"timestamp":"2014-03-23T18:57:16.093Z","uuid":"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc","temperature":"78","wind":"12","ipAddress":"127.0.0.1","eventCode":700,"_id":"532f2e8c9c23809e93000002"}</pre>
<br />
</div>
</td></tr></table>
</div>
<br />
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/data/{uuid}</b>
<br />Returns last 10 data updates related to a specific device or node
<br />Optional query parameters include: start (time to start from), finish (time to end),
limit (overrides the default 10 updates)
<br />Note: You can make this API stream sensor data by adding stream=true to the querystring. Notice the comma at the end of the response. SkyNet doesn't close the stream.
<br />
<pre>curl -L -X GET http://skynet.im/data/0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc --header "skynet_auth_uuid: {my uuid}" --header "skynet_auth_token: {my token}"</pre>
<pre>curl -L -X GET http://skynet.im/data/0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc?stream=true --header "skynet_auth_uuid: {my uuid}" --header "skynet_auth_token: {my token}"</pre>
<pre>{"data":[{"timestamp":"2014-03-23T18:57:16.093Z","uuid":"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc","temperature":"78","wind":"12","ipAddress":"127.0.0.1","id":"532f2e8c9c23809e93000001"}]}</pre>
</div>
</td></tr></table>
</div>
</div>
<br/><br/>
</div>
</section>
</div>
<div class="tab-pane fade" id="coap_api">
<section id="restapi">
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<h1>CoAP API</h1>
</div>
<div class="col-md-12">
<h1>Base URI: coap://skynet.im</h1>
</div>
<div class="col-md-12">
<h1>Status</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/status</b>
<br />Returns the SkyNet platform status
<br />
<pre>coap get coap://skynet.im/status</pre>
<pre>{"skynet":"online","timestamp":1381536589633,"eventCode":200,"_id":"5258934d56330f7dd0000009"}</pre>
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<h1>Devices</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/devices?key=value&key=value</b>
<br />Returns an array of device UUIDs based on key/value query criteria
<br />
<pre>coap get coap://skynet.im/devices?type=drone</pre>
<pre>{"devices":["ad698900-2546-11e3-87fb-c560cb0ca47b","2f3113d0-2796-11e3-95ef-e3081976e170"]}</pre>
<br />
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/devices/{uuid}</b>
<br />Returns all information (except the token) of a specific device or node
<br />
<pre>coap get coap://skynet.im/devices/ad698900-2546-11e3-87fb-c560cb0ca47b</pre>
<pre>{"_id":"5241d9140345450000000001","api":"update","armed":true,"channel":"main","deviceDescription":"this is a test","deviceName":"hackboard","key":"777","online":true,"socketid":"fO8dxKEwARUH9Ea--p2C","timestamp":1381536277933,"uuid":"ad698900-2546-11e3-87fb-c560cb0ca47b"}</pre>
<br />
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-success" disabled> POST</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/devices</b><br />
<b>Payload: key=value (i.e. type=drone&color=black)</b>
<br />Registers a node or device with SkyNet. SkyNet returns a UUID device id and security token. You can pass any key/value pairs and even override SkyNet's auto-generated UUID and/or token by passing your own uuid and/or token in the payload i.e. uuid=123&token=456
<br />
<pre>coap post -p "type=drone&color=black" coap://skynet.im/devices</pre>
<pre>{"type":"drone","color":"black","uuid":"6f72bc60-32d5-11e3-92e2-e94f95fc16a6","timestamp":1381537803046,"token":"4bbd2jm242dl5wmimbwz4rvlu77m0a4i","channel":"main","online":false,"_id":"5258980b56330f7dd000000d"}</pre>
<br />
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-warning" disabled> PUT</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/devices/{uuid}</b><br />
<b>Payload: token=123&key=value (i.e. token=123&type=drone&color=blue&online=true)</b>
<br />Updates a node or device currently registered with SkyNet. You must pass the token for security but you can pass any key/value pairs to update object as well as null to remove a propery (i.e. color=null).
<br />
<pre>coap put -p "token=123&color=blue&online=true" coap://skynet.im/devices/ad698900-2546-11e3-87fb-c560cb0ca47b</pre>
<pre>{"uuid":"ad698900-2546-11e3-87fb-c560cb0ca47b","color":"blue","timestamp":1381537750462}</pre>
<br />
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-danger" disabled> DELETE</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/devices/{uuid}</b><br />
<b>Payload: token=123</b>
<br />Deletes or unregisters a node or device currently registered with SkyNet. You must pass the token for security.
<br />
<pre>coap delete -p "token=123" coap://skynet.im/devices/ad698900-2546-11e3-87fb-c560cb0ca47b</pre>
<pre>{"uuid":"ad698900-2546-11e3-87fb-c560cb0ca47b","timestamp":1381537971074}</pre>
<br />
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<h1>myDevices</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/mydevices/{uuid}</b>
<br />Returns all information (including tokens) of all devices or nodes belonging to a user's UUID (identified with an "owner" property and user's UUID i.e. "owner":"0d1234a0-1234-11e3-b09c-1234e847b2cc")
<br />
<pre>coap get coap://skynet.im/mydevices/0d1234a0-1234-11e3-b09c-1234e847b2cc?token=1234glm6y1234ldix1234nux41234sor</pre>
<pre>{"devices":[{"owner":"0d1234a0-1234-11e3-b09c-1234e847b2cc","name":"SMS","phoneNumber":"16025551234","uuid":"1c1234e1-xxxx-11e3-1234-671234c01234","timestamp":1390861609070,"token":"1234eg1234zz1tt1234w0op12346bt9","channel":"main","online":false,"_id":"52e6d1234980420c4a0001db"}}]}</pre>
<br />
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<h1>Messages</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-success" disabled> POST</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/messages</b>
<br />Send a message to a specific device, array of devices, or all devices subscribing to a UUID on the SkyNet platform
<br />
<pre>coap post -p '{"devices": "*", "payload": {"yellow":"off"}}' coap://skynet.im/messages</pre>
<pre>coap post -p '{"devices": ["ad6...47b","2f3...170"], "payload": {"yellow":"off"}}' coap://skynet.im/messages</pre>
<pre>coap post -p '{"devices": "ad698900-2546-11e3-87fb-c560cb0ca47b", "payload": {"yellow":"off"}}' coap://skynet.im/messages</pre>
<pre>{"devices":"*","payload":{"yellow":"off"}}</pre>
<!-- <pre>{"devices":"all","message":{"yellow":"off"}</pre> -->
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<h1>Events</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/events/{uuid}?token={token}</b>
<br />Returns last 10 events related to a specific device or node
<br />
<pre>coap get coap://skynet.im/events/ad698900-2546-11e3-87fb-c560cb0ca47b?token=123</pre>
<pre>{"events":[{"uuid":"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc","socketid":"lnHHS06ijWUXEzb01ZRy","timestamp":1382632438785,"eventCode":101,"_id":"52694bf6ad11379eec00003f"},{"uuid":"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc","socketid":"BuwnWQ_oLmpk5R3m1ZRv","timestamp":1382561240563,"eventCode":101,"_id":"526835d8ad11379eec000017"}]}</pre>
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<h1>Subscribe</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/subscribe/{uuid}?token={token}</b>
<br />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.
<br />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)
<br />
<pre>coap get coap://skynet.im/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b?token=123 -o</pre>
<pre>{"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"},</pre>
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<h1>Authenticate</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/authenticate/{uuid}?token={token}</b>
<br />Returns UUID and authticate: true or false based on the validity of uuid/token credentials
<br />
<pre>coap get coap://skynet.im/authenticate/81246e80-29fd-11e3-9468-e5f892df566b?token=5ypy4rurayktke29ypbi30kcw5ovfgvi</pre>
<pre>{"uuid":"81246e80-29fd-11e3-9468-e5f892df566b","authentication":true} OR {"uuid":"81246e80-29fd-11e3-9468-e5f892df566b","authentication":false}</pre>
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<h1>IP Address</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/ipaddress</b>
<br />Returns the public IP address of the request. This is useful when working with the SkyNet Gateway behind a firewall.
<br />
<pre>coap get coap://skynet.im/ipaddress</pre>
<pre>{"ipAddress":"70.171.149.205"}</pre>
</div>
</td></tr></table>
</div>
<div class="col-md-12">
<h1>Data</h1>
</div>
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-success" disabled> POST</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/data/{uuid}</b><br />
<b>Payload: token=value&key=value (i.e. temperature=78&humity=30)</b>
<br />Stores sensor data for a particular UUID. You can pass any key/value pairs.
<br />
<pre>coap post -p "token=123&temperature=78" coap://skynet.im/data/0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc</pre>
<pre>{"timestamp":"2014-03-23T18:57:16.093Z","uuid":"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc","temperature":"78","ipAddress":"127.0.0.1","eventCode":700,"_id":"532f2e8c9c23809e93000002"}</pre>
<br />
</div>
</td></tr></table>
</div>
<br />
<div class="col-md-12">
<table width="100%"><tr><td width="200px">
<div class="feature col-md-2 text-center">
<button class="btn btn-large btn-info" disabled> GET</button>
</div>
</td>
<td>
<div class="feature col-md-10">
<b>/data/{uuid}?token={token}</b>
<br />Returns last 10 data updates related to a specific device or node
<br />Optional query parameters include: start (time to start from), finish (time to end),
limit (overrides the default 10 updates)
<br />Note: You can make this API stream sensor data by adding stream=true to the querystring. Notice the comma at the end of the response. SkyNet doesn't close the stream.
<br />
<pre>coap get coap://skynet.im/data/0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc?token=123</pre>
<pre>coap get coap://skynet.im/data/0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc?token=123&stream=true -o</pre>
<pre>{"data":[{"timestamp":"2014-03-23T18:57:16.093Z","uuid":"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc","temperature":"78","ipAddress":"127.0.0.1","id":"532f2e8c9c23809e93000001"}]}</pre>
</div>
</td></tr></table>
</div>
</div>
<br/><br/>
<h4>
<center>
Note: The CoAP examples are using <a href="https://twitter.com/matteocollina">Matteo Collina's</a> <a href="https://www.npmjs.org/package/coap-cli">CoAP CLI</a> testing tool.
</center>
</h4>
</div>
</section>
</div>
<div class="tab-pane fade" id="websocket_api">
<section id="restapi">
<div class="container">
<div class="page-header text-center">
<h1>Realtime WebSocket API</h1>
</div>
<div class="row">
<div class="col-md-12">
<h2>
SkyNet offers a realtime websocket API as well as a Node.JS NPM module to make event-driven IoT development fast and easy.
When nodes and devices register with SkyNet, they are assigned a unique id known as a UUID along with a security token. (Note: tokens can be provided by the request rather than having SkyNet assign one for you.)
</h2>
<h2>
Upon connecting your node or device to SkyNet, you can query and update devices on the network and send machine-to-machine (M2M) messages in an RPC-style fashion.
Here are the basics for a socket.io implementation of using native websockets:
</h2>
</div>
<pre>
var io = require('socket.io-client')
socket = io.connect('http://skynet.im', {
port: 80
});
socket.on('connect', function(){
console.log('Requesting websocket connection to SkyNet');
socket.on('identify', function(data){
console.log('Websocket connecting to SkyNet with socket id: ' + data.socketid);
console.log('Sending device uuid: ad698900-2546-11e3-87fb-c560cb0ca47b');
socket.emit('identity', {uuid: 'ad698900-2546-11e3-87fb-c560cb0ca47b', socketid: data.socketid, token: 'zh4p7as90pt1q0k98fzvwmc9rmjkyb9'});
});
socket.on('notReady', function(data){
if (data.status == 401){
console.log('Device not authenticated with SkyNet');
}
});
socket.on('ready', function(data){
if (data.status == 201){
console.log('Device authenticated with SkyNet');
// Send/Receive messages
socket.emit("message",{
"devices": ["0d3a53...847b2cc", "11123...44567"],
"payload": {
"red":"on"
}, function (data) {
console.log(data);
}
});
socket.on('message', function(message){
console.log('message received', message);
// { devices: '0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc',
payload: { red: 'on' },
fromUuid: '0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc' }
});
// Sample SkyNet API calls:
socket.emit('status', function(data){
console.log('status received');
console.log(data);
// { skynet: 'online' }
});
// Subscribe and unsubscribe to a device's messages and events
socket.emit('subscribe', {
"uuid": "0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc",
"token": "qirqglm6yb1vpldixflopnux4phtcsor"
}, function (data) {
console.log(data);
// {"api":"subscribe","socketid":"j3WWX81JwWYzaidRaNA7","fromUuid":"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc","toUuid":"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc"}
});
socket.emit('unsubscribe', {"uuid": "0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc"}, function (data) {
console.log(data);
// {"api":"unsubscribe","socketid":"j3WWX81JwWYzaidRaNA7","uuid":"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc"}
});
// Register device
socket.emit('register', {
"type":"drone"
}, function (data) {
console.log(data);