Minnow

Check-in [d5a95872d3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update to current
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA1:d5a95872d319cfbdd0a762bf563f2dc7f1aa6462
User & Date: jim 2013-02-23 11:54:11
Context
2013-02-23
11:54
Update to current Leaf check-in: d5a95872d3 user: jim tags: trunk
2012-02-11
11:42
Update and edit documentation check-in: 632b3461a2 user: jim tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Docs/Minnow.lyx.

1
2
3
4
5
6
7
8
9
...
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
...
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
...
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
...
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
...
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
...
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
...
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
...
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
...
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
....
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
....
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
....
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
....
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
....
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
....
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
....
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
....
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
....
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
....
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
....
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
....
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
....
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
....
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
....
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
....
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
....
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
....
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
....
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
....
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
....
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
....
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
....
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
....
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
....
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
....
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
....
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
....
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
....
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
....
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
....
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
....
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
....
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
....
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
....
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
....
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
....
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
....
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
....
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
....
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
....
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
....
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
....
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
....
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
....
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
....
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
....
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
....
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
....
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
....
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
....
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
....
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
....
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
....
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
....
6244
6245
6246
6247
6248
6249
6250

6251
6252
6253
6254
6255
6256
6257
#LyX 1.6.2 created this file. For more info see http://www.lyx.org/
\lyxformat 345
\begin_document
\begin_header
\textclass article
\begin_preamble

% Include the proper LaTeX packages:
%----------------------------------------------------------------------------------------------------
................................................................................
%------------------------------------------------------------------------------------------
\renewcommand{\footrulewidth}{0.4pt}
\fancyfoot[L]{\sffamily \bfseries \documentNumber \\ \mdseries Revision:  \revisionNumber}
\fancyfoot[C]{\sffamily \bfseries\thedate \\ \mdseries Firing Box Manual}
\fancyfoot[R]{\ifthenelse{\boolean{romanpn}}{\sffamily  \thepage}{\sffamily \bfseries Page \thepage\ of \pageref{LastPage}}}
\end_preamble
\use_default_options false

\language english

\inputencoding auto

\font_roman times
\font_sans helvet
\font_typewriter courier
\font_default_family default

\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100

\graphics default




\paperfontsize 11
\spacing single
\use_hyperref false
\papersize letterpaper
\use_geometry false
\use_amsmath 1
\use_esint 0


\cite_engine basic
\use_bibtopic false

\paperorientation portrait






\secnumdepth 4
\tocdepth 4
\paragraph_separation skip
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle fancy
\tracking_changes false
\output_changes false
\author "" 
\author "" 

\end_header

\begin_body

\begin_layout Standard
\begin_inset ERT
status open
................................................................................

\begin_layout Plain Layout


\backslash
renewcommand{
\backslash
reportTopic}{Minnow Restful Webserver}
\end_layout

\end_inset


\end_layout

................................................................................
.
\end_layout

\begin_layout Standard
\align center
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="4">
<features>
<column alignment="center" valignment="top" width="0.5in">
<column alignment="center" valignment="top" width="0.5in">
<column alignment="block" valignment="top" width="3in">
<column alignment="center" valignment="top" width="1in">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
................................................................................
\begin_inset Newpage newpage
\end_inset


\end_layout

\begin_layout Section
Minnow Webserver
\end_layout

\begin_layout Subsection
Introduction
\end_layout

\begin_layout Standard
................................................................................
This software is a Lua
\begin_inset CommandInset citation
LatexCommand cite
key "Lua"

\end_inset

interperter (5.1 version) that has extensions 
\begin_inset CommandInset citation
LatexCommand cite
key "libmicrohttpd"

\end_inset

to support serving web pages it is also designed to easily support RESTful
................................................................................
\begin_inset CommandInset citation
LatexCommand cite
key "AJAX"

\end_inset

.
 The Lua interperter also has extensions added to support JSON
\begin_inset CommandInset citation
LatexCommand cite
key "JSON"

\end_inset

and some other useful server side actions.
................................................................................
\end_layout

\begin_layout Subsection
Demonstrations
\end_layout

\begin_layout Subsubsection
Building Minnow
\end_layout

\begin_layout Standard
On download of the Minnow source you have to build it (XCode on OS X or
 makefile in Linux) .The download include demonstration websites to show
 the capabilities of Minnow.
 If you are on OS X then double click the X Code project and and built it.
 You will then find the Minnow executable in build
\backslash
Debug Intel and can copy it to the Minnow directory for further work.
\end_layout

\begin_layout Standard
On Linux cd to the Minnow directory after exapanding the ZIP download and
 then type make.
 The executable should build and leave it in the Minnow directory.
\end_layout

\begin_layout Subsubsection
Webserver Example
\end_layout

\begin_layout Standard
Start Minnow with the command line (I'm assuming you are in the Minnow directory
 and the executable is there):
\end_layout

................................................................................
\begin_layout LyX-Code

\size footnotesize
./Minnow -c Site_Simple/main.lua -http Site_Simple -port 8081
\end_layout

\begin_layout Standard
Now you have a simple webserver running on your machine on port 8081 so
 if you type http://localhost:8081 in your browser you will get:
\end_layout

\begin_layout Standard
\begin_inset Float figure
placement H
wide false
................................................................................
\end_layout

\begin_layout Subsubsection
Lua Example
\end_layout

\begin_layout Standard
Minnow is also built around a Lua interperter.
 If you start Minnow with no command line options you will be in the Lua
 interperter.
 The only non-standard thing is the 
\series bold
quit 
\series default
keyword which will exit the interperter.
 
\end_layout

\begin_layout LyX-Code
552 > ./Minnow
\end_layout

................................................................................
\end_layout

\begin_layout LyX-Code
-- End Run --
\end_layout

\begin_layout Subsubsection
Webserver with REST
\end_layout

\begin_layout Standard
Included in the demo code for Minnow is a RESTful example where Minnow not
 only serves up webpages but also accepts and responds to RESTful commands
 from the browser client.
 
................................................................................

\end_inset


\end_layout

\begin_layout Standard
At tbis point you can click on Debug or Logout.
 Logout will take you back to the initial screen while debug will let you
 issue RESTful commands and see the responses.
\end_layout

\begin_layout Subsubsection
Debug Operation
\end_layout
................................................................................
\end_layout

\begin_layout Section
Demonstration Site Operation
\end_layout

\begin_layout Standard
The operation of the Minnow as a Lua interperter and simple webserver are
 easily seen from the demonstration.
 Operation as a RESTful server is much more complicated and involves interaction
 between client code (HTML/CSS/Javascript/JQuery) and server code (Lua).
 This will be set out in detail here and will give you enough information
 to develop your own sites.
 NOTE: You will need knowledge of Javascript/JQuery and Lua to use Minnow
 in this way.
................................................................................
\begin_layout Standard
The highlighted portion is the initial server server script this 
\series bold
main.lua
\series default
 reads the command line for the subsequent parameters and uses them to start
 the web server.
 The RESTful operation is supported by code that turns each incomming request
 URI into a Lua list.
 It's important to note that this script does not get all the requests only
 those that start with 
\series bold
http://localhost:8081/rest
\series default
 .
................................................................................
\begin_layout Subsubsection
Server Summary
\end_layout

\begin_layout Standard
On the server side you will need main script like main.lua to start the process
 and define the top level commands (following rest/...) .
 In the demonstraton we only have one (
\series bold
admin
\series default
) but for more complicated situations you will have many more.
 Also in main you will have require lines bringing in these support scripts
\end_layout

................................................................................
\begin_inset CommandInset label
LatexCommand label
name "sub:ADMIN/TIME"

\end_inset

ADMIN/TIME
\begin_inset Index
status open

\begin_layout Plain Layout
TIME
\end_layout

\end_inset
................................................................................
\begin_layout Standard
This is used to read out the server system clock.
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................

\begin_layout LyX-Code
{ "TIME" : "Sun Nov 14 16:46:21 2010" }
\end_layout

\begin_layout Subsubsection
ADMIN/POWER
\begin_inset Index
status open

\begin_layout Plain Layout
POWER
\end_layout

\end_inset
................................................................................
\begin_layout Standard
This URI is used to check for system running and to shutdown the system
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="4">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
................................................................................
)
\end_layout

\begin_layout Standard

\series bold
ADMIN/LOGIN/REQUEST
\begin_inset Index
status open

\begin_layout Plain Layout

\series bold
REQUEST
\end_layout
................................................................................
\begin_layout Standard
Used to request a challenge value.
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................

\begin_layout Standard

\series bold
ADMIN/LOGIN/RESPONSE
\series default

\begin_inset Index
status open

\begin_layout Plain Layout
RESPONSE
\end_layout

\end_inset
................................................................................
\begin_layout Standard
This is used to return the response to the challenge.
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................

\end_layout

\begin_layout Standard

\series bold
ADMIN/LOGIN/STATUS
\begin_inset Index
status open

\begin_layout Plain Layout

\series bold
STATUS
\end_layout
................................................................................
\begin_layout Standard
This is used to query the server on the login status
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................

\end_layout

\begin_layout Standard

\series bold
ADMIN/LOGIN/LOGOUT
\begin_inset Index
status open

\begin_layout Plain Layout

\series bold
LOGOUT
\end_layout
................................................................................


\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................
\begin_inset CommandInset citation
LatexCommand cite
key "HTTP"

\end_inset

 is very well suited for this task.
 It is small, selfcontained and is designed to be added into applications.
 
\end_layout

\begin_layout Standard
In addition a JSON parser has been added to support data sent in this form.
 JSON messages out are easily generated using formatted write statements
 in Lua.
................................................................................

\begin_layout Subsubsection
Class Methods - Server Control
\end_layout

\begin_layout Paragraph
http.start()
\begin_inset Index
status open

\begin_layout Plain Layout
http.start()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
status = http.start(port,http_base,rest_base)
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="5" columns="3">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................
\begin_layout Standard
More details on the data and path information will be found in the http.url()
 method.
\end_layout

\begin_layout Paragraph
http.stop()
\begin_inset Index
status open

\begin_layout Plain Layout
http.stop()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
http.stop()
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................
\begin_inset CommandInset label
LatexCommand label
name "par:http.open()"

\end_inset

http.lock()
\begin_inset Index
status open

\begin_layout Plain Layout
http.lock()
\end_layout

\end_inset
................................................................................
 will be accepted till the server is unlocked.
 All other requesters will get a 404.
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="3">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................
\begin_layout Standard
Would lock the server to 192.168.1.103 any other client would get a 404 on
 any request.
\end_layout

\begin_layout Paragraph
http.open()
\begin_inset Index
status open

\begin_layout Plain Layout
http.open()
\end_layout

\end_inset
................................................................................
 If a request is present you will be returned a handle to the request, if
 none you will get nil.
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................
You can use this call to poll for requests, note the requests are queued
 so any pending requests are held till you retrieve them.
 You can have multiple outstanding requests.
\end_layout

\begin_layout Paragraph
http.close()
\begin_inset Index
status open

\begin_layout Plain Layout
http.close()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
http.close(rh,data) or rh:close(data)
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="3">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................
 Either form is acceptable.
 This is used to return the result of a RESTful request to the client.
 The data is usually encoded as JSON and will available to the client.
\end_layout

\begin_layout Paragraph
http.url(h)
\begin_inset Index
status open

\begin_layout Plain Layout
http.url()
\end_layout

\end_inset
................................................................................
\begin_layout Standard
This method is used to get the URI of the request.
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="3">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................
\end_layout

\begin_layout Standard
\noindent
\align center
\begin_inset Tabular
<lyxtabular version="3" rows="6" columns="2">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
................................................................................
\end_layout

\begin_layout Standard
\noindent
\align center
\begin_inset Tabular
<lyxtabular version="3" rows="10" columns="2">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
................................................................................

\begin_layout Standard
The highlighted items are the only ones normally used in the RESTful protocol.
\end_layout

\begin_layout Paragraph
http.data()
\begin_inset Index
status open

\begin_layout Plain Layout
http.data()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code

\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................

\begin_layout Standard
This class is used to turn JSON into a LUA list.
\end_layout

\begin_layout Paragraph
parsers.json()
\begin_inset Index
status open

\begin_layout Plain Layout
parsers.json()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
json_list = parsers.json(json_string)
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................

\begin_layout Standard
See the JSON references for an idea of what sort of structures you can expect.
\end_layout

\begin_layout Paragraph
json_kvp()
\begin_inset Index
status open

\begin_layout Plain Layout
json_kvp
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
rtnval = json_kvp(myresult)
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features>
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................

\begin_layout Subsubsection
Timer Class Methods
\end_layout

\begin_layout Paragraph
timer.sleep()
\begin_inset Index
status open

\begin_layout Plain Layout
timer.sleep()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
handle:sleep(ms)
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features>
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................

\begin_layout Subsubsection
Timer Constructors/Destructors
\end_layout

\begin_layout Paragraph
timer.new()
\begin_inset Index
status open

\begin_layout Plain Layout
timer.new()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
handle = timer.new()
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features>
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................
\begin_layout Standard
The handle is opened and timer is started at 0.
 
\end_layout

\begin_layout Paragraph
timer.delete()
\begin_inset Index
status open

\begin_layout Plain Layout
timer.delete()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
handle:delete()
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features>
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................

\begin_layout Subsubsection
Timer Methods
\end_layout

\begin_layout Paragraph
timer.start()
\begin_inset Index
status open

\begin_layout Plain Layout
timer.start()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
result = timer.start(handle) or handle:start()
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features>
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................
\end_inset


\end_layout

\begin_layout Paragraph
timer.done()
\begin_inset Index
status open

\begin_layout Plain Layout
timer.done()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
handle:done(delay)
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="3">
<features>
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................
\end_inset


\end_layout

\begin_layout Paragraph
timer.read()
\begin_inset Index
status open

\begin_layout Plain Layout
timer.read()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
handle:read()
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features>
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................

\begin_layout Subsubsection
Class Methods
\end_layout

\begin_layout Paragraph
kbd.prep()
\begin_inset Index
status open

\begin_layout Plain Layout
kbd.prep()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
kbd.prep()
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features>
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................
\end_inset


\end_layout

\begin_layout Paragraph
kbd.close()
\begin_inset Index
status open

\begin_layout Plain Layout
kbd.close()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
kbd.close()
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features>
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................
\end_inset


\end_layout

\begin_layout Paragraph
kbd.getc()
\begin_inset Index
status open

\begin_layout Plain Layout
kbd.getc()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
ch = kbd.getc()
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features>
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................
\series bold
kdb.close()
\end_layout

\begin_layout Standard
\begin_inset CommandInset index_print
LatexCommand printindex


\end_inset


\end_layout

\begin_layout Standard
|
|







 







>

>

>




>






>
>
>
>







>
>


>

>
>
>
>
>
>










|
|
>







 







|







 







|







 







|







 







|







 







|







 







|













|





|







 







|







 







|

|




|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







>







1
2
3
4
5
6
7
8
9
...
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
...
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
...
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
...
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
...
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
...
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
...
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
...
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
...
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
....
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
....
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
....
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
....
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
....
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
....
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
....
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
....
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
....
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
....
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
....
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
....
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
....
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
....
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
....
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
....
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
....
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
....
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
....
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
....
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
....
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
....
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
....
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
....
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
....
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
....
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
....
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
....
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
....
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
....
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
....
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
....
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
....
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
....
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
....
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
....
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
....
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
....
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
....
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
....
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
....
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
....
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
....
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
....
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
....
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
....
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
....
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
....
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
....
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
....
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
....
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
....
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
....
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
....
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
....
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
#LyX 2.0 created this file. For more info see http://www.lyx.org/
\lyxformat 413
\begin_document
\begin_header
\textclass article
\begin_preamble

% Include the proper LaTeX packages:
%----------------------------------------------------------------------------------------------------
................................................................................
%------------------------------------------------------------------------------------------
\renewcommand{\footrulewidth}{0.4pt}
\fancyfoot[L]{\sffamily \bfseries \documentNumber \\ \mdseries Revision:  \revisionNumber}
\fancyfoot[C]{\sffamily \bfseries\thedate \\ \mdseries Firing Box Manual}
\fancyfoot[R]{\ifthenelse{\boolean{romanpn}}{\sffamily  \thepage}{\sffamily \bfseries Page \thepage\ of \pageref{LastPage}}}
\end_preamble
\use_default_options false
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman times
\font_sans helvet
\font_typewriter courier
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100

\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize 11
\spacing single
\use_hyperref false
\papersize letterpaper
\use_geometry false
\use_amsmath 1
\use_esint 0
\use_mhchem 1
\use_mathdots 1
\cite_engine basic
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\use_refstyle 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 4
\tocdepth 4
\paragraph_separation skip
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle fancy
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard
\begin_inset ERT
status open
................................................................................

\begin_layout Plain Layout


\backslash
renewcommand{
\backslash
reportTopic}{Minnow Restful Web server}
\end_layout

\end_inset


\end_layout

................................................................................
.
\end_layout

\begin_layout Standard
\align center
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="4">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0.5in">
<column alignment="center" valignment="top" width="0.5in">
<column alignment="block" valignment="top" width="3in">
<column alignment="center" valignment="top" width="1in">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
................................................................................
\begin_inset Newpage newpage
\end_inset


\end_layout

\begin_layout Section
Minnow Web server
\end_layout

\begin_layout Subsection
Introduction
\end_layout

\begin_layout Standard
................................................................................
This software is a Lua
\begin_inset CommandInset citation
LatexCommand cite
key "Lua"

\end_inset

interpreter (5.1 version) that has extensions 
\begin_inset CommandInset citation
LatexCommand cite
key "libmicrohttpd"

\end_inset

to support serving web pages it is also designed to easily support RESTful
................................................................................
\begin_inset CommandInset citation
LatexCommand cite
key "AJAX"

\end_inset

.
 The Lua interpreter also has extensions added to support JSON
\begin_inset CommandInset citation
LatexCommand cite
key "JSON"

\end_inset

and some other useful server side actions.
................................................................................
\end_layout

\begin_layout Subsection
Demonstrations
\end_layout

\begin_layout Subsubsection
Building Minnow from source
\end_layout

\begin_layout Standard
On download of the Minnow source you have to build it (XCode on OS X or
 makefile in Linux) .The download include demonstration websites to show
 the capabilities of Minnow.
 If you are on OS X then double click the X Code project and and built it.
 You will then find the Minnow executable in build
\backslash
Debug Intel and can copy it to the Minnow directory for further work.
\end_layout

\begin_layout Standard
On Linux cd to the Minnow directory after expanding the ZIP download and
 then type make.
 The executable should build and leave it in the Minnow directory.
\end_layout

\begin_layout Subsubsection
Web server Example
\end_layout

\begin_layout Standard
Start Minnow with the command line (I'm assuming you are in the Minnow directory
 and the executable is there):
\end_layout

................................................................................
\begin_layout LyX-Code

\size footnotesize
./Minnow -c Site_Simple/main.lua -http Site_Simple -port 8081
\end_layout

\begin_layout Standard
Now you have a simple web server running on your machine on port 8081 so
 if you type http://localhost:8081 in your browser you will get:
\end_layout

\begin_layout Standard
\begin_inset Float figure
placement H
wide false
................................................................................
\end_layout

\begin_layout Subsubsection
Lua Example
\end_layout

\begin_layout Standard
Minnow is also built around a Lua interpreter.
 If you start Minnow with no command line options you will be in the Lua
 interpreter.
 The only non-standard thing is the 
\series bold
quit 
\series default
keyword which will exit the interpreter.
 
\end_layout

\begin_layout LyX-Code
552 > ./Minnow
\end_layout

................................................................................
\end_layout

\begin_layout LyX-Code
-- End Run --
\end_layout

\begin_layout Subsubsection
Web server with REST
\end_layout

\begin_layout Standard
Included in the demo code for Minnow is a RESTful example where Minnow not
 only serves up webpages but also accepts and responds to RESTful commands
 from the browser client.
 
................................................................................

\end_inset


\end_layout

\begin_layout Standard
At this point you can click on Debug or Logout.
 Logout will take you back to the initial screen while debug will let you
 issue RESTful commands and see the responses.
\end_layout

\begin_layout Subsubsection
Debug Operation
\end_layout
................................................................................
\end_layout

\begin_layout Section
Demonstration Site Operation
\end_layout

\begin_layout Standard
The operation of the Minnow as a Lua interpreter and simple web server are
 easily seen from the demonstration.
 Operation as a RESTful server is much more complicated and involves interaction
 between client code (HTML/CSS/Javascript/JQuery) and server code (Lua).
 This will be set out in detail here and will give you enough information
 to develop your own sites.
 NOTE: You will need knowledge of Javascript/JQuery and Lua to use Minnow
 in this way.
................................................................................
\begin_layout Standard
The highlighted portion is the initial server server script this 
\series bold
main.lua
\series default
 reads the command line for the subsequent parameters and uses them to start
 the web server.
 The RESTful operation is supported by code that turns each incoming request
 URI into a Lua list.
 It's important to note that this script does not get all the requests only
 those that start with 
\series bold
http://localhost:8081/rest
\series default
 .
................................................................................
\begin_layout Subsubsection
Server Summary
\end_layout

\begin_layout Standard
On the server side you will need main script like main.lua to start the process
 and define the top level commands (following rest/...) .
 In the demonstration we only have one (
\series bold
admin
\series default
) but for more complicated situations you will have many more.
 Also in main you will have require lines bringing in these support scripts
\end_layout

................................................................................
\begin_inset CommandInset label
LatexCommand label
name "sub:ADMIN/TIME"

\end_inset

ADMIN/TIME
\begin_inset Index idx
status open

\begin_layout Plain Layout
TIME
\end_layout

\end_inset
................................................................................
\begin_layout Standard
This is used to read out the server system clock.
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................

\begin_layout LyX-Code
{ "TIME" : "Sun Nov 14 16:46:21 2010" }
\end_layout

\begin_layout Subsubsection
ADMIN/POWER
\begin_inset Index idx
status open

\begin_layout Plain Layout
POWER
\end_layout

\end_inset
................................................................................
\begin_layout Standard
This URI is used to check for system running and to shutdown the system
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="4">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
................................................................................
)
\end_layout

\begin_layout Standard

\series bold
ADMIN/LOGIN/REQUEST
\begin_inset Index idx
status open

\begin_layout Plain Layout

\series bold
REQUEST
\end_layout
................................................................................
\begin_layout Standard
Used to request a challenge value.
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................

\begin_layout Standard

\series bold
ADMIN/LOGIN/RESPONSE
\series default

\begin_inset Index idx
status open

\begin_layout Plain Layout
RESPONSE
\end_layout

\end_inset
................................................................................
\begin_layout Standard
This is used to return the response to the challenge.
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................

\end_layout

\begin_layout Standard

\series bold
ADMIN/LOGIN/STATUS
\begin_inset Index idx
status open

\begin_layout Plain Layout

\series bold
STATUS
\end_layout
................................................................................
\begin_layout Standard
This is used to query the server on the login status
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................

\end_layout

\begin_layout Standard

\series bold
ADMIN/LOGIN/LOGOUT
\begin_inset Index idx
status open

\begin_layout Plain Layout

\series bold
LOGOUT
\end_layout
................................................................................


\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................
\begin_inset CommandInset citation
LatexCommand cite
key "HTTP"

\end_inset

 is very well suited for this task.
 It is small, self-contained and is designed to be added into applications.
 
\end_layout

\begin_layout Standard
In addition a JSON parser has been added to support data sent in this form.
 JSON messages out are easily generated using formatted write statements
 in Lua.
................................................................................

\begin_layout Subsubsection
Class Methods - Server Control
\end_layout

\begin_layout Paragraph
http.start()
\begin_inset Index idx
status open

\begin_layout Plain Layout
http.start()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
status = http.start(port,http_base,rest_base)
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="5" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................
\begin_layout Standard
More details on the data and path information will be found in the http.url()
 method.
\end_layout

\begin_layout Paragraph
http.stop()
\begin_inset Index idx
status open

\begin_layout Plain Layout
http.stop()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
http.stop()
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................
\begin_inset CommandInset label
LatexCommand label
name "par:http.open()"

\end_inset

http.lock()
\begin_inset Index idx
status open

\begin_layout Plain Layout
http.lock()
\end_layout

\end_inset
................................................................................
 will be accepted till the server is unlocked.
 All other requesters will get a 404.
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................
\begin_layout Standard
Would lock the server to 192.168.1.103 any other client would get a 404 on
 any request.
\end_layout

\begin_layout Paragraph
http.open()
\begin_inset Index idx
status open

\begin_layout Plain Layout
http.open()
\end_layout

\end_inset
................................................................................
 If a request is present you will be returned a handle to the request, if
 none you will get nil.
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................
You can use this call to poll for requests, note the requests are queued
 so any pending requests are held till you retrieve them.
 You can have multiple outstanding requests.
\end_layout

\begin_layout Paragraph
http.close()
\begin_inset Index idx
status open

\begin_layout Plain Layout
http.close()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
http.close(rh,data) or rh:close(data)
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................
 Either form is acceptable.
 This is used to return the result of a RESTful request to the client.
 The data is usually encoded as JSON and will available to the client.
\end_layout

\begin_layout Paragraph
http.url(h)
\begin_inset Index idx
status open

\begin_layout Plain Layout
http.url()
\end_layout

\end_inset
................................................................................
\begin_layout Standard
This method is used to get the URI of the request.
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................
\end_layout

\begin_layout Standard
\noindent
\align center
\begin_inset Tabular
<lyxtabular version="3" rows="6" columns="2">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
................................................................................
\end_layout

\begin_layout Standard
\noindent
\align center
\begin_inset Tabular
<lyxtabular version="3" rows="10" columns="2">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
................................................................................

\begin_layout Standard
The highlighted items are the only ones normally used in the RESTful protocol.
\end_layout

\begin_layout Paragraph
http.data()
\begin_inset Index idx
status open

\begin_layout Plain Layout
http.data()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code

\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................

\begin_layout Standard
This class is used to turn JSON into a LUA list.
\end_layout

\begin_layout Paragraph
parsers.json()
\begin_inset Index idx
status open

\begin_layout Plain Layout
parsers.json()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
json_list = parsers.json(json_string)
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................

\begin_layout Standard
See the JSON references for an idea of what sort of structures you can expect.
\end_layout

\begin_layout Paragraph
json_kvp()
\begin_inset Index idx
status open

\begin_layout Plain Layout
json_kvp
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
rtnval = json_kvp(myresult)
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

................................................................................

\begin_layout Subsubsection
Timer Class Methods
\end_layout

\begin_layout Paragraph
timer.sleep()
\begin_inset Index idx
status open

\begin_layout Plain Layout
timer.sleep()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
handle:sleep(ms)
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................

\begin_layout Subsubsection
Timer Constructors/Destructors
\end_layout

\begin_layout Paragraph
timer.new()
\begin_inset Index idx
status open

\begin_layout Plain Layout
timer.new()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
handle = timer.new()
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................
\begin_layout Standard
The handle is opened and timer is started at 0.
 
\end_layout

\begin_layout Paragraph
timer.delete()
\begin_inset Index idx
status open

\begin_layout Plain Layout
timer.delete()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
handle:delete()
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................

\begin_layout Subsubsection
Timer Methods
\end_layout

\begin_layout Paragraph
timer.start()
\begin_inset Index idx
status open

\begin_layout Plain Layout
timer.start()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
result = timer.start(handle) or handle:start()
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................
\end_inset


\end_layout

\begin_layout Paragraph
timer.done()
\begin_inset Index idx
status open

\begin_layout Plain Layout
timer.done()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
handle:done(delay)
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................
\end_inset


\end_layout

\begin_layout Paragraph
timer.read()
\begin_inset Index idx
status open

\begin_layout Plain Layout
timer.read()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
handle:read()
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................

\begin_layout Subsubsection
Class Methods
\end_layout

\begin_layout Paragraph
kbd.prep()
\begin_inset Index idx
status open

\begin_layout Plain Layout
kbd.prep()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
kbd.prep()
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................
\end_inset


\end_layout

\begin_layout Paragraph
kbd.close()
\begin_inset Index idx
status open

\begin_layout Plain Layout
kbd.close()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
kbd.close()
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................
\end_inset


\end_layout

\begin_layout Paragraph
kbd.getc()
\begin_inset Index idx
status open

\begin_layout Plain Layout
kbd.getc()
\end_layout

\end_inset
................................................................................
\begin_layout LyX-Code
ch = kbd.getc()
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<column alignment="center" valignment="top" width="0sp">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

................................................................................
\series bold
kdb.close()
\end_layout

\begin_layout Standard
\begin_inset CommandInset index_print
LatexCommand printindex
type "idx"

\end_inset


\end_layout

\begin_layout Standard

Changes to Docs/Minnow.pdf.

cannot compute difference between binary files

Changes to Minnow.xcodeproj/project.xcworkspace/xcuserdata/jim.xcuserdatad/UserInterfaceState.xcuserstate.

cannot compute difference between binary files

Changes to Minnow.xcodeproj/xcuserdata/jim.xcuserdatad/xcschemes/Firenet.xcscheme.

40
41
42
43
44
45
46

47
48
49
50
51
52
53
   </TestAction>
   <LaunchAction
      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
      launchStyle = "0"
      useCustomWorkingDirectory = "NO"
      buildConfiguration = "Debug INTEL"

      debugDocumentVersioning = "YES"
      allowLocationSimulation = "YES">
      <BuildableProductRunnable>
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "8DD76FA90486AB0100D96B5E"
            BuildableName = "Minnow"







>







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
   </TestAction>
   <LaunchAction
      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
      launchStyle = "0"
      useCustomWorkingDirectory = "NO"
      buildConfiguration = "Debug INTEL"
      ignoresPersistentStateOnLaunch = "NO"
      debugDocumentVersioning = "YES"
      allowLocationSimulation = "YES">
      <BuildableProductRunnable>
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "8DD76FA90486AB0100D96B5E"
            BuildableName = "Minnow"