UNPKG

21.9 kBHTMLView Raw
1<!DOCTYPE html>
2
3<html lang="en">
4<head>
5 <meta charset="utf-8">
6 <meta name="viewport" content="width=device-width">
7 <title>Documentation Global</title>
8
9 <!--[if lt IE 9]>
10 <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11 <![endif]-->
12 <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
13
14 <link type="text/css" rel="stylesheet" href="styles/site.simplex.css">
15
16</head>
17
18<body>
19
20<div class="navbar navbar-default navbar-fixed-top ">
21<div class="container">
22 <div class="navbar-header">
23 <a class="navbar-brand" href="index.html">Documentation</a>
24 <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
25 <span class="icon-bar"></span>
26 <span class="icon-bar"></span>
27 <span class="icon-bar"></span>
28 </button>
29 </div>
30 <div class="navbar-collapse collapse" id="topNavigation">
31 <ul class="nav navbar-nav">
32
33 <li class="dropdown">
34 <a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a>
35 <ul class="dropdown-menu ">
36 <li><a href="CatSnake.html">CatSnake</a></li>
37 </ul>
38 </li>
39
40 <li class="dropdown">
41 <a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
42 <ul class="dropdown-menu ">
43 <li><a href="global.html#deny">deny</a></li><li><a href="global.html#grant">grant</a></li><li><a href="global.html#history">history</a></li><li><a href="global.html#info">info</a></li><li><a href="global.html#publish">publish</a></li><li><a href="global.html#subscribe">subscribe</a></li>
44 </ul>
45 </li>
46
47 </ul>
48 <div class="col-sm-3 col-md-3">
49 <form class="navbar-form" role="search">
50 <div class="input-group">
51 <input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
52 <div class="input-group-btn">
53 <button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
54 </div>
55 </div>
56 </form>
57 </div>
58 </div>
59
60</div>
61</div>
62
63
64<div class="container" id="toc-content">
65<div class="row">
66
67
68 <div class="col-md-8">
69
70 <div id="main">
71
72
73 <h1 class="page-title">Global</h1>
74<section>
75
76<header>
77
78 <h2>
79
80 </h2>
81
82
83</header>
84
85
86<article>
87 <div class="container-overview">
88
89
90
91
92<dl class="details">
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</dl>
129
130
131
132
133 </div>
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148 <h3 class="subsection-title">Methods</h3>
149
150 <dl>
151
152<hr>
153<dt>
154 <h4 class="name" id="deny"><span class="type-signature"></span>deny(channel, client, secret)</h4>
155
156
157</dt>
158<dd>
159
160
161 <div class="description">
162 Deny a client access to a channel
163 </div>
164
165
166
167
168
169
170
171
172 <h5>Parameters:</h5>
173
174
175<table class="params table table-striped">
176 <thead>
177 <tr>
178
179 <th>Name</th>
180
181
182 <th>Type</th>
183
184
185
186
187
188 <th class="last">Description</th>
189 </tr>
190 </thead>
191
192 <tbody>
193
194
195 <tr>
196
197 <td class="name"><code>channel</code></td>
198
199
200 <td class="type">
201
202
203<span class="param-type">string</span>
204
205
206
207
208 </td>
209
210
211
212
213
214 <td class="description last">the channel in which to deny the client from</td>
215 </tr>
216
217
218
219 <tr>
220
221 <td class="name"><code>client</code></td>
222
223
224 <td class="type">
225
226
227<span class="param-type">string</span>
228
229
230
231
232 </td>
233
234
235
236
237
238 <td class="description last">the client to deny</td>
239 </tr>
240
241
242
243 <tr>
244
245 <td class="name"><code>secret</code></td>
246
247
248 <td class="type">
249
250
251<span class="param-type">string</span>
252
253
254
255
256 </td>
257
258
259
260
261
262 <td class="description last">the secret key associated with this channel</td>
263 </tr>
264
265
266 </tbody>
267</table>
268
269
270
271
272<dl class="details">
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</dl>
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324</dd>
325
326
327
328<hr>
329<dt>
330 <h4 class="name" id="grant"><span class="type-signature"></span>grant(channel, client, secret)</h4>
331
332
333</dt>
334<dd>
335
336
337 <div class="description">
338 Grant a client access to a channel
339 </div>
340
341
342
343
344
345
346
347
348 <h5>Parameters:</h5>
349
350
351<table class="params table table-striped">
352 <thead>
353 <tr>
354
355 <th>Name</th>
356
357
358 <th>Type</th>
359
360
361
362
363
364 <th class="last">Description</th>
365 </tr>
366 </thead>
367
368 <tbody>
369
370
371 <tr>
372
373 <td class="name"><code>channel</code></td>
374
375
376 <td class="type">
377
378
379<span class="param-type">string</span>
380
381
382
383
384 </td>
385
386
387
388
389
390 <td class="description last">the channel in which to grant the client access to</td>
391 </tr>
392
393
394
395 <tr>
396
397 <td class="name"><code>client</code></td>
398
399
400 <td class="type">
401
402
403<span class="param-type">string</span>
404
405
406
407
408 </td>
409
410
411
412
413
414 <td class="description last">the client to grant access</td>
415 </tr>
416
417
418
419 <tr>
420
421 <td class="name"><code>secret</code></td>
422
423
424 <td class="type">
425
426
427<span class="param-type">string</span>
428
429
430
431
432 </td>
433
434
435
436
437
438 <td class="description last">the secret key associated with this channel</td>
439 </tr>
440
441
442 </tbody>
443</table>
444
445
446
447
448<dl class="details">
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</dl>
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500</dd>
501
502
503
504<hr>
505<dt>
506 <h4 class="name" id="history"><span class="type-signature"></span>history(channel, limit, opts)</h4>
507
508
509</dt>
510<dd>
511
512
513 <div class="description">
514 Get message history from a channel.
515 </div>
516
517
518
519
520
521
522
523
524 <h5>Parameters:</h5>
525
526
527<table class="params table table-striped">
528 <thead>
529 <tr>
530
531 <th>Name</th>
532
533
534 <th>Type</th>
535
536
537
538
539
540 <th class="last">Description</th>
541 </tr>
542 </thead>
543
544 <tbody>
545
546
547 <tr>
548
549 <td class="name"><code>channel</code></td>
550
551
552 <td class="type">
553
554
555<span class="param-type">string</span>
556
557
558
559
560 </td>
561
562
563
564
565
566 <td class="description last">the channel to pull history from</td>
567 </tr>
568
569
570
571 <tr>
572
573 <td class="name"><code>limit</code></td>
574
575
576 <td class="type">
577
578
579<span class="param-type">number</span>
580
581
582
583
584 </td>
585
586
587
588
589
590 <td class="description last">the ammount of items to pull from history</td>
591 </tr>
592
593
594
595 <tr>
596
597 <td class="name"><code>opts</code></td>
598
599
600 <td class="type">
601
602
603<span class="param-type">object</span>
604
605
606
607
608 </td>
609
610
611
612
613
614 <td class="description last">options such as privateKeys
615 <h6 class="method-params-label method-subparams-label">Properties</h6>
616
617
618<table class="params table table-striped">
619 <thead>
620 <tr>
621
622 <th>Name</th>
623
624
625 <th>Type</th>
626
627
628
629
630
631 <th class="last">Description</th>
632 </tr>
633 </thead>
634
635 <tbody>
636
637
638 <tr>
639
640 <td class="name"><code>privateKey</code></td>
641
642
643 <td class="type">
644
645
646<span class="param-type">string</span>
647
648
649
650
651 </td>
652
653
654
655
656
657 <td class="description last">private key used for getting history from private channels</td>
658 </tr>
659
660
661 </tbody>
662</table>
663
664 </td>
665 </tr>
666
667
668 </tbody>
669</table>
670
671
672
673
674<dl class="details">
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</dl>
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726</dd>
727
728
729
730<hr>
731<dt>
732 <h4 class="name" id="info"><span class="type-signature"></span>info(channel, data, opts)</h4>
733
734
735</dt>
736<dd>
737
738
739 <div class="description">
740 List channels, get client info.
741 </div>
742
743
744
745
746
747
748
749
750 <h5>Parameters:</h5>
751
752
753<table class="params table table-striped">
754 <thead>
755 <tr>
756
757 <th>Name</th>
758
759
760 <th>Type</th>
761
762
763
764
765
766 <th class="last">Description</th>
767 </tr>
768 </thead>
769
770 <tbody>
771
772
773 <tr>
774
775 <td class="name"><code>channel</code></td>
776
777
778 <td class="type">
779
780
781<span class="param-type">string</span>
782
783
784
785
786 </td>
787
788
789
790
791
792 <td class="description last">the channel to look at</td>
793 </tr>
794
795
796
797 <tr>
798
799 <td class="name"><code>data</code></td>
800
801
802 <td class="type">
803
804
805<span class="param-type">object</span>
806
807
808
809
810 </td>
811
812
813
814
815
816 <td class="description last">additional information for request</td>
817 </tr>
818
819
820
821 <tr>
822
823 <td class="name"><code>opts</code></td>
824
825
826 <td class="type">
827
828
829<span class="param-type">object</span>
830
831
832
833
834 </td>
835
836
837
838
839
840 <td class="description last">additional options for subscriptions
841 <h6 class="method-params-label method-subparams-label">Properties</h6>
842
843
844<table class="params table table-striped">
845 <thead>
846 <tr>
847
848 <th>Name</th>
849
850
851 <th>Type</th>
852
853
854
855
856
857 <th class="last">Description</th>
858 </tr>
859 </thead>
860
861 <tbody>
862
863
864 <tr>
865
866 <td class="name"><code>privateKey</code></td>
867
868
869 <td class="type">
870
871
872<span class="param-type">string</span>
873
874
875
876
877 </td>
878
879
880
881
882
883 <td class="description last">private key used for getting info from private channels</td>
884 </tr>
885
886
887 </tbody>
888</table>
889
890 </td>
891 </tr>
892
893
894 </tbody>
895</table>
896
897
898
899
900<dl class="details">
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</dl>
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952</dd>
953
954
955
956<hr>
957<dt>
958 <h4 class="name" id="publish"><span class="type-signature"></span>publish(channel, data, privateKey)</h4>
959
960
961</dt>
962<dd>
963
964
965 <div class="description">
966 Publishes a message to all subscribers
967 </div>
968
969
970
971
972
973
974
975
976 <h5>Parameters:</h5>
977
978
979<table class="params table table-striped">
980 <thead>
981 <tr>
982
983 <th>Name</th>
984
985
986 <th>Type</th>
987
988
989
990
991
992 <th class="last">Description</th>
993 </tr>
994 </thead>
995
996 <tbody>
997
998
999 <tr>
1000
1001 <td class="name"><code>channel</code></td>
1002
1003
1004 <td class="type">
1005
1006
1007<span class="param-type">string</span>
1008
1009
1010
1011
1012 </td>
1013
1014
1015
1016
1017
1018 <td class="description last">the channel to publish to</td>
1019 </tr>
1020
1021
1022
1023 <tr>
1024
1025 <td class="name"><code>data</code></td>
1026
1027
1028 <td class="type">
1029
1030
1031<span class="param-type">object</span>
1032
1033
1034
1035
1036 </td>
1037
1038
1039
1040
1041
1042 <td class="description last">the object to publish</td>
1043 </tr>
1044
1045
1046
1047 <tr>
1048
1049 <td class="name"><code>privateKey</code></td>
1050
1051
1052 <td class="type">
1053
1054
1055<span class="param-type">string</span>
1056
1057
1058
1059
1060 </td>
1061
1062
1063
1064
1065
1066 <td class="description last">optional private key for private channels</td>
1067 </tr>
1068
1069
1070 </tbody>
1071</table>
1072
1073
1074
1075
1076<dl class="details">
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112</dl>
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128</dd>
1129
1130
1131
1132<hr>
1133<dt>
1134 <h4 class="name" id="subscribe"><span class="type-signature"></span>subscribe(channel, callback, opts)</h4>
1135
1136
1137</dt>
1138<dd>
1139
1140
1141 <div class="description">
1142 Subscribe to a channel
1143 </div>
1144
1145
1146
1147
1148
1149
1150
1151
1152 <h5>Parameters:</h5>
1153
1154
1155<table class="params table table-striped">
1156 <thead>
1157 <tr>
1158
1159 <th>Name</th>
1160
1161
1162 <th>Type</th>
1163
1164
1165
1166
1167
1168 <th class="last">Description</th>
1169 </tr>
1170 </thead>
1171
1172 <tbody>
1173
1174
1175 <tr>
1176
1177 <td class="name"><code>channel</code></td>
1178
1179
1180 <td class="type">
1181
1182
1183<span class="param-type">string</span>
1184
1185
1186
1187
1188 </td>
1189
1190
1191
1192
1193
1194 <td class="description last">the channel to subscribe to</td>
1195 </tr>
1196
1197
1198
1199 <tr>
1200
1201 <td class="name"><code>callback</code></td>
1202
1203
1204 <td class="type">
1205
1206
1207<span class="param-type">function</span>
1208
1209
1210
1211
1212 </td>
1213
1214
1215
1216
1217
1218 <td class="description last">new messages are returned here via msg
1219 <h6 class="method-params-label method-subparams-label">Properties</h6>
1220
1221
1222<table class="params table table-striped">
1223 <thead>
1224 <tr>
1225
1226 <th>Name</th>
1227
1228
1229 <th>Type</th>
1230
1231
1232
1233
1234
1235 <th class="last">Description</th>
1236 </tr>
1237 </thead>
1238
1239 <tbody>
1240
1241
1242 <tr>
1243
1244 <td class="name"><code>msg</code></td>
1245
1246
1247 <td class="type">
1248
1249
1250<span class="param-type">object</span>
1251
1252
1253
1254
1255 </td>
1256
1257
1258
1259
1260
1261 <td class="description last">a new payload published to this channel</td>
1262 </tr>
1263
1264
1265 </tbody>
1266</table>
1267
1268 </td>
1269 </tr>
1270
1271
1272
1273 <tr>
1274
1275 <td class="name"><code>opts</code></td>
1276
1277
1278 <td class="type">
1279
1280
1281<span class="param-type">object</span>
1282
1283
1284
1285
1286 </td>
1287
1288
1289
1290
1291
1292 <td class="description last">additional options for subscriptions
1293 <h6 class="method-params-label method-subparams-label">Properties</h6>
1294
1295
1296<table class="params table table-striped">
1297 <thead>
1298 <tr>
1299
1300 <th>Name</th>
1301
1302
1303 <th>Type</th>
1304
1305
1306
1307
1308
1309 <th class="last">Description</th>
1310 </tr>
1311 </thead>
1312
1313 <tbody>
1314
1315
1316 <tr>
1317
1318 <td class="name"><code>privateKey</code></td>
1319
1320
1321 <td class="type">
1322
1323
1324<span class="param-type">string</span>
1325
1326
1327
1328
1329 </td>
1330
1331
1332
1333
1334
1335 <td class="description last">private key used for subscribing to private channels</td>
1336 </tr>
1337
1338
1339
1340 <tr>
1341
1342 <td class="name"><code>noself</code></td>
1343
1344
1345 <td class="type">
1346
1347
1348<span class="param-type">string</span>
1349
1350
1351
1352
1353 </td>
1354
1355
1356
1357
1358
1359 <td class="description last">subscribe for everything but ignore your own payloads</td>
1360 </tr>
1361
1362
1363
1364 <tr>
1365
1366 <td class="name"><code>accessToken</code></td>
1367
1368
1369 <td class="type">
1370
1371
1372<span class="param-type">string</span>
1373
1374
1375
1376
1377 </td>
1378
1379
1380
1381
1382
1383 <td class="description last">used as a key to modify private channels. Not to be confused with privateKey</td>
1384 </tr>
1385
1386
1387
1388 <tr>
1389
1390 <td class="name"><code>private</code></td>
1391
1392
1393 <td class="type">
1394
1395
1396<span class="param-type">string</span>
1397
1398
1399
1400
1401 </td>
1402
1403
1404
1405
1406
1407 <td class="description last">make this channel private, clients can only connect if granted access</td>
1408 </tr>
1409
1410
1411 </tbody>
1412</table>
1413
1414 </td>
1415 </tr>
1416
1417
1418 </tbody>
1419</table>
1420
1421
1422
1423
1424<dl class="details">
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460</dl>
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476</dd>
1477
1478 </dl>
1479
1480
1481
1482 <h3 class="subsection-title">Type Definitions</h3>
1483
1484 <dl>
1485
1486<hr>
1487<dt>
1488 <h4 class="name" id="stringifyinternal"><span class="type-signature"></span>stringify (data)</h4>
1489
1490
1491</dt>
1492<dd>
1493
1494
1495 <div class="description">
1496 Tries to return a stringified object.
1497 </div>
1498
1499
1500
1501
1502
1503
1504
1505
1506 <h5>Parameters:</h5>
1507
1508
1509<table class="params table table-striped">
1510 <thead>
1511 <tr>
1512
1513 <th>Name</th>
1514
1515
1516 <th>Type</th>
1517
1518
1519
1520
1521
1522 <th class="last">Description</th>
1523 </tr>
1524 </thead>
1525
1526 <tbody>
1527
1528
1529 <tr>
1530
1531 <td class="name"><code>data</code></td>
1532
1533
1534 <td class="type">
1535
1536
1537<span class="param-type">object</span>
1538
1539
1540
1541
1542 </td>
1543
1544
1545
1546
1547
1548 <td class="description last">the object to attempt to stringify</td>
1549 </tr>
1550
1551
1552 </tbody>
1553</table>
1554
1555
1556
1557
1558<dl class="details">
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594</dl>
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610</dd>
1611
1612 </dl>
1613
1614
1615
1616</article>
1617
1618</section>
1619
1620
1621
1622
1623 </div>
1624 </div>
1625
1626 <div class="clearfix"></div>
1627
1628
1629 <div class="col-md-3">
1630 <div id="toc" class="col-md-3 hidden-xs hidden-sm hidden-md"></div>
1631 </div>
1632
1633
1634</div>
1635</div>
1636
1637<div class="modal fade" id="searchResults">
1638 <div class="modal-dialog">
1639 <div class="modal-content">
1640 <div class="modal-header">
1641 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
1642 <h4 class="modal-title">Search results</h4>
1643 </div>
1644 <div class="modal-body"></div>
1645 <div class="modal-footer">
1646 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1647 </div>
1648 </div><!-- /.modal-content -->
1649 </div><!-- /.modal-dialog -->
1650</div>
1651
1652<footer>
1653
1654
1655<span class="jsdoc-message">
1656 Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a>
1657
1658 on 2016-04-07T21:54:42-04:00
1659
1660 using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
1661</span>
1662</footer>
1663
1664<script src="scripts/docstrap.lib.js"></script>
1665<script src="scripts/toc.js"></script>
1666<script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
1667
1668<script>
1669$( function () {
1670 $( "[id*='$']" ).each( function () {
1671 var $this = $( this );
1672
1673 $this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
1674 } );
1675
1676 $( ".tutorial-section pre, .readme-section pre" ).each( function () {
1677 var $this = $( this );
1678
1679 var example = $this.find( "code" );
1680 exampleText = example.html();
1681 var lang = /{@lang (.*?)}/.exec( exampleText );
1682 if ( lang && lang[1] ) {
1683 exampleText = exampleText.replace( lang[0], "" );
1684 example.html( exampleText );
1685 lang = lang[1];
1686 } else {
1687 var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
1688 lang = langClassMatch ? langClassMatch[1] : "javascript";
1689 }
1690
1691 if ( lang ) {
1692
1693 $this
1694 .addClass( "sunlight-highlight-" + lang )
1695 .addClass( "linenums" )
1696 .html( example.html() );
1697
1698 }
1699 } );
1700
1701 Sunlight.highlightAll( {
1702 lineNumbers : false,
1703 showMenu : true,
1704 enableDoclinks : true
1705 } );
1706
1707 $.catchAnchorLinks( {
1708 navbarOffset: 10
1709 } );
1710 $( "#toc" ).toc( {
1711 anchorName : function ( i, heading, prefix ) {
1712 var id = $( heading ).attr( "id" );
1713 return id && id.replace(/\~/g, '-inner-').replace(/\./g, '-static-') || ( prefix + i );
1714 },
1715 selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
1716 showAndHide : false,
1717 smoothScrolling: true
1718 } );
1719
1720 $( "#main span[id^='toc']" ).addClass( "toc-shim" );
1721 $( '.dropdown-toggle' ).dropdown();
1722
1723 $( "table" ).each( function () {
1724 var $this = $( this );
1725 $this.addClass('table');
1726 } );
1727
1728} );
1729</script>
1730
1731
1732
1733<!--Navigation and Symbol Display-->
1734
1735
1736<!--Google Analytics-->
1737
1738
1739<script type="text/javascript">
1740 $(document).ready(function() {
1741 SearcherDisplay.init();
1742 });
1743</script>
1744
1745</body>
1746</html>
\No newline at end of file