w-converhp 1.0.40 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,7 +29,7 @@
29
29
  <nav >
30
30
 
31
31
 
32
- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="WConverhpClient.html">WConverhpClient</a><ul class='methods'><li data-type='method'><a href="WConverhpClient.html#.broadcast">broadcast</a></li><li data-type='method'><a href="WConverhpClient.html#.deliver">deliver</a></li><li data-type='method'><a href="WConverhpClient.html#.execute">execute</a></li><li data-type='method'><a href="WConverhpClient.html#.onError">onError</a></li><li data-type='method'><a href="WConverhpClient.html#.onOpen">onOpen</a></li><li data-type='method'><a href="WConverhpClient.html#.onOpenOnce">onOpenOnce</a></li></ul></li><li><a href="WConverhpServer.html">WConverhpServer</a><ul class='methods'><li data-type='method'><a href="WConverhpServer.html#.broadcast">broadcast</a></li><li data-type='method'><a href="WConverhpServer.html#.deliver">deliver</a></li><li data-type='method'><a href="WConverhpServer.html#.onBroadcast">onBroadcast</a></li><li data-type='method'><a href="WConverhpServer.html#.onClientChange">onClientChange</a></li><li data-type='method'><a href="WConverhpServer.html#.onClientEnter">onClientEnter</a></li><li data-type='method'><a href="WConverhpServer.html#.onClientLeave">onClientLeave</a></li><li data-type='method'><a href="WConverhpServer.html#.onDeliver">onDeliver</a></li><li data-type='method'><a href="WConverhpServer.html#.onError">onError</a></li><li data-type='method'><a href="WConverhpServer.html#.onExecute">onExecute</a></li><li data-type='method'><a href="WConverhpServer.html#.onOpen">onOpen</a></li></ul></li></ul>
32
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="WConverhpClient.html">WConverhpClient</a></li><li><a href="WConverhpServer.html">WConverhpServer</a></li></ul>
33
33
 
34
34
  </nav>
35
35
 
@@ -80,7 +80,7 @@
80
80
 
81
81
  <dt class="tag-source">Source:</dt>
82
82
  <dd class="tag-source"><ul class="dummy"><li>
83
- <a href="WConverhpServer.mjs.html">WConverhpServer.mjs</a>, <a href="WConverhpServer.mjs.html#line121">line 121</a>
83
+ <a href="WConverhpServer.mjs.html">WConverhpServer.mjs</a>, <a href="WConverhpServer.mjs.html#line119">line 119</a>
84
84
  </li></ul></dd>
85
85
 
86
86
 
@@ -127,7 +127,7 @@
127
127
 
128
128
  <h5 class="h5-examples">Example</h5>
129
129
 
130
- <pre class="prettyprint"><code>import WConverhpServer from 'w-converhp/dist/w-converhp-server.umd.js'
131
130
  port: 8080,
132
131
  apiName: 'api',
133
132
  console.log(`Server[port:${opt.port}]: open`)
134
133
  //broadcast
135
134
  let n = 0
136
135
  setInterval(() => {
137
136
  n += 1
138
137
  let o = {
139
138
  text: `server broadcast hi(${n})`,
140
139
  data: new Uint8Array([66, 97, 115]), //support Uint8Array data
141
140
  }
142
141
  wo.broadcast(o, function (prog) {
143
142
  console.log('broadcast prog', prog)
144
143
  })
145
144
  }, 1000)
146
145
  console.log(`Server[port:${opt.port}]: error`, err)
147
146
  console.log(`Server[port:${opt.port}]: now clients: ${num}`)
148
147
  console.log(`Server[port:${opt.port}]: client enter: ${clientId}`)
149
148
  //deliver
150
149
  wo.deliver(clientId, `server deliver hi(${clientId})`)
151
150
  console.log(`Server[port:${opt.port}]: client leave: ${clientId}`)
152
151
  //console.log(`Server[port:${opt.port}]: execute`, func, input)
153
152
  console.log(`Server[port:${opt.port}]: execute`, func)
154
153
  try {
155
154
  if (func === 'add') {
156
155
  //save
157
156
  if (_.get(input, 'p.d.u8a', null)) {
158
157
  // fs.writeFileSync(input.p.d.name, Buffer.from(input.p.d.u8a))
159
158
  // console.log('writeFileSync input.p.d.name', input.p.d.name)
160
159
  }
161
160
  let r = {
162
161
  ab: input.p.a + input.p.b,
163
162
  v: [11, 22.22, 'abc', { x: '21', y: 65.43, z: 'test中文' }],
164
163
  file: {
165
164
  name: 'zdata.b2',
166
165
  u8a: new Uint8Array([66, 97, 115]),
167
166
  //u8a: new Uint8Array(fs.readFileSync('C:\\Users\\Administrator\\Desktop\\z500mb.7z')),
168
167
  },
169
168
  }
170
169
  pm.resolve(r)
171
170
  }
172
171
  else {
173
172
  console.log('invalid func')
174
173
  pm.reject('invalid func')
175
174
  }
176
175
  }
177
176
  catch (err) {
178
177
  console.log('execute error', err)
179
178
  pm.reject('execute error')
180
179
  }
181
180
  console.log(`Server[port:${opt.port}]: broadcast`, data)
182
181
  console.log(`Server[port:${opt.port}]: deliver`, data)
183
182
  // console.log(`Server[port:${opt.port}]: handler`, data)
183
+ <pre class="prettyprint"><code>import _ from 'lodash-es'
184
184
  port: 8080,
185
185
  apiName: 'api',
186
186
  pathStaticFiles: '.', //要存取專案資料夾下web.html, 故不能給dist
187
187
  funCheck: () => {
188
188
  return true
189
189
  },
190
190
  // console.log(`Server[port:${opt.port}]: execute`, func, input)
191
191
  console.log(`Server[port:${opt.port}]: execute`, func)
192
192
  try {
193
193
  if (func === 'add') {
194
194
  if (_.get(input, 'p.d.u8a', null)) {
195
195
  console.log('input.p.d.u8a', input.p.d.u8a)
196
196
  }
197
197
  let r = {
198
198
  _add: input.p.a + input.p.b,
199
199
  _data: [11, 22.22, 'abc', { x: '21', y: 65.43, z: 'test中文' }],
200
200
  _bin: {
201
201
  name: 'zdata.b2',
202
202
  u8a: new Uint8Array([66, 97, 115]),
203
203
  // name: '100mb.7z',
204
204
  // u8a: new Uint8Array(fs.readFileSync('D:\\開源-JS-006-2-w-converhp\\_temp\\100mb.7z')),
205
205
  // name: '500mb.7z',
206
206
  // u8a: new Uint8Array(fs.readFileSync('D:\\開源-JS-006-2-w-converhp\\_temp\\500mb.7z')),
207
207
  // name: '1000mb.7z',
208
208
  // u8a: new Uint8Array(fs.readFileSync('D:\\開源-JS-006-2-w-converhp\\_temp\\1000mb.7z')),
209
209
  },
210
210
  }
211
211
  pm.resolve(r)
212
212
  }
213
213
  else {
214
214
  console.log('invalid func')
215
215
  pm.reject('invalid func')
216
216
  }
217
217
  }
218
218
  catch (err) {
219
219
  console.log('execute error', err)
220
220
  pm.reject('execute error')
221
221
  }
222
222
  console.log(`Server[port:${opt.port}]: upload`, input)
223
223
  try {
224
224
  let output = input
225
225
  pm.resolve(output)
226
226
  }
227
227
  catch (err) {
228
228
  console.log('execute error', err)
229
229
  pm.reject('execute error')
230
230
  }
231
231
  // console.log(`Server[port:${opt.port}]: handler`, data)
232
232
 
233
233
 
234
234
 
@@ -257,20 +257,20 @@
257
257
  </td>
258
258
 
259
259
 
260
- <td class="description last"><p>輸入Hapi伺服器所在port,預設8080</p></td>
260
+ <td class="description last"><p>輸入Hapi伺服器所在port正整數,預設8080</p></td>
261
261
  </tr>
262
262
 
263
263
 
264
264
 
265
265
  <tr>
266
266
 
267
- <td class="name"><code>apiName</code></td>
267
+ <td class="name"><code>useInert</code></td>
268
268
 
269
269
 
270
270
  <td class="type">
271
271
 
272
272
 
273
- <span class="param-type">String</span>
273
+ <span class="param-type">Boolean</span>
274
274
 
275
275
 
276
276
 
@@ -285,1309 +285,66 @@
285
285
 
286
286
 
287
287
 
288
-
289
- </td>
290
-
291
-
292
-
293
- <td class="default">
294
-
295
- <code>'api'</code>
296
-
297
- </td>
298
-
299
-
300
- <td class="description last"><p>輸入http API伺服器網址的api名稱,預設'api'</p></td>
301
- </tr>
302
-
303
-
304
- </tbody>
305
- </table>
306
-
307
- </td>
308
- </tr>
309
-
310
-
311
- </tbody>
312
- </table>
313
-
314
-
315
-
316
-
317
-
318
-
319
-
320
-
321
-
322
-
323
-
324
-
325
-
326
-
327
-
328
-
329
- <h5 class="h5-returns">Returns:</h5>
330
-
331
-
332
- <div class="param-desc">
333
- <p>回傳通訊物件,可監聽事件open、error、clientChange、execute、broadcast、deliver,可使用函數broadcast</p>
334
- </div>
335
-
336
-
337
-
338
- <dl class="param-type">
339
- <dt>
340
- Type
341
- </dt>
342
- <dd>
343
-
344
- <span class="param-type">Object</span>
345
-
346
-
347
-
348
- </dd>
349
- </dl>
350
-
351
-
352
-
353
-
354
-
355
-
356
- </div>
357
-
358
-
359
-
360
-
361
-
362
-
363
-
364
-
365
-
366
-
367
-
368
-
369
-
370
-
371
-
372
-
373
-
374
- <h3 class="subsection-title">Methods</h3>
375
-
376
-
377
-
378
-
379
-
380
-
381
- <h4 class="name" id=".broadcast"><span class="type-signature type-signature-static">(static) </span>broadcast<span class="signature">(data, cb)</span><span class="type-signature"></span></h4>
382
-
383
-
384
-
385
-
386
-
387
-
388
- <dl class="details">
389
-
390
- <dt class="tag-description">Description:</dt>
391
- <dd class="tag-description"><ul class="dummy"><li><p>Hapi通訊物件對全客戶端廣播函數</p></li></ul></dd>
392
-
393
-
394
-
395
- <dt class="tag-source">Source:</dt>
396
- <dd class="tag-source"><ul class="dummy"><li>
397
- <a href="WConverhpServer.mjs.html">WConverhpServer.mjs</a>, <a href="WConverhpServer.mjs.html#line509">line 509</a>
398
- </li></ul></dd>
399
-
400
-
401
-
402
-
403
-
404
-
405
-
406
-
407
-
408
-
409
-
410
-
411
-
412
-
413
-
414
-
415
-
416
-
417
-
418
-
419
-
420
-
421
-
422
-
423
-
424
-
425
-
426
-
427
-
428
-
429
-
430
- </dl>
431
-
432
-
433
-
434
-
435
-
436
-
437
-
438
-
439
-
440
-
441
-
442
- <h5 class="h5-examples">Example</h5>
443
-
444
- <pre class="prettyprint"><code>let data = {...}
445
-
446
-
447
-
448
-
449
- <h5 class="h5-parameters">Parameters:</h5>
450
-
451
-
452
- <table class="params">
453
- <thead>
454
- <tr>
455
-
456
- <th>Name</th>
457
-
458
-
459
- <th>Type</th>
460
-
461
-
462
-
463
-
464
-
465
- <th class="last">Description</th>
466
- </tr>
467
- </thead>
468
-
469
- <tbody>
470
-
471
-
472
- <tr>
473
-
474
- <td class="name"><code>data</code></td>
475
-
476
-
477
- <td class="type">
478
-
479
-
480
- <span class="param-type">*</span>
481
-
482
-
483
-
484
-
485
- </td>
486
-
487
-
488
-
489
-
490
-
491
- <td class="description last"><p>輸入廣播函數之輸入資訊</p></td>
492
- </tr>
493
-
494
-
495
-
496
- <tr>
497
-
498
- <td class="name"><code>cb</code></td>
499
-
500
-
501
- <td class="type">
502
-
503
-
504
- <span class="param-type">function</span>
505
-
506
-
507
-
508
-
509
- </td>
510
-
511
-
512
-
513
-
514
-
515
- <td class="description last"><p>輸入進度函數</p></td>
516
- </tr>
517
-
518
-
519
- </tbody>
520
- </table>
521
-
522
-
523
-
524
-
525
-
526
-
527
-
528
-
529
-
530
-
531
-
532
-
533
-
534
-
535
-
536
-
537
-
538
-
539
-
540
-
541
-
542
-
543
-
544
-
545
- <h4 class="name" id=".deliver"><span class="type-signature type-signature-static">(static) </span>deliver<span class="signature">(clientId, data, cb)</span><span class="type-signature"></span></h4>
546
-
547
-
548
-
549
-
550
-
551
-
552
- <dl class="details">
553
-
554
- <dt class="tag-description">Description:</dt>
555
- <dd class="tag-description"><ul class="dummy"><li><p>Hapi通訊物件對客戶端發送訊息函數</p></li></ul></dd>
556
-
557
-
558
-
559
- <dt class="tag-source">Source:</dt>
560
- <dd class="tag-source"><ul class="dummy"><li>
561
- <a href="WConverhpServer.mjs.html">WConverhpServer.mjs</a>, <a href="WConverhpServer.mjs.html#line550">line 550</a>
562
- </li></ul></dd>
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
- </dl>
595
-
596
-
597
-
598
-
599
-
600
-
601
-
602
-
603
-
604
-
605
-
606
- <h5 class="h5-examples">Example</h5>
607
-
608
- <pre class="prettyprint"><code>let clientId = '...'
609
-
610
-
611
-
612
-
613
- <h5 class="h5-parameters">Parameters:</h5>
614
-
615
-
616
- <table class="params">
617
- <thead>
618
- <tr>
619
-
620
- <th>Name</th>
621
-
622
-
623
- <th>Type</th>
624
-
625
-
626
-
627
-
628
-
629
- <th class="last">Description</th>
630
- </tr>
631
- </thead>
632
-
633
- <tbody>
634
-
635
-
636
- <tr>
637
-
638
- <td class="name"><code>clientId</code></td>
639
-
640
-
641
- <td class="type">
642
-
643
-
644
- <span class="param-type">String</span>
645
-
646
-
647
-
648
-
649
- </td>
650
-
651
-
652
-
653
-
654
-
655
- <td class="description last"><p>輸入識別用使用者主鍵字串</p></td>
656
- </tr>
657
-
658
-
659
-
660
- <tr>
661
-
662
- <td class="name"><code>data</code></td>
663
-
664
-
665
- <td class="type">
666
-
667
-
668
- <span class="param-type">*</span>
669
-
670
-
671
-
672
-
673
- </td>
674
-
675
-
676
-
677
-
678
-
679
- <td class="description last"><p>輸入發送函數之輸入資訊</p></td>
680
- </tr>
681
-
682
-
683
-
684
- <tr>
685
-
686
- <td class="name"><code>cb</code></td>
687
-
688
-
689
- <td class="type">
690
-
691
-
692
- <span class="param-type">function</span>
693
-
694
-
695
-
696
-
697
- </td>
698
-
699
-
700
-
701
-
702
-
703
- <td class="description last"><p>輸入進度函數</p></td>
704
- </tr>
705
-
706
-
707
- </tbody>
708
- </table>
709
-
710
-
711
-
712
-
713
-
714
-
715
-
716
-
717
-
718
-
719
-
720
-
721
-
722
-
723
-
724
-
725
-
726
-
727
-
728
-
729
-
730
-
731
-
732
-
733
- <h4 class="name" id=".onBroadcast"><span class="type-signature type-signature-static">(static) </span>onBroadcast<span class="signature">(data)</span><span class="type-signature"></span></h4>
734
-
735
-
736
-
737
-
738
-
739
-
740
- <dl class="details">
741
-
742
- <dt class="tag-description">Description:</dt>
743
- <dd class="tag-description"><ul class="dummy"><li><p>Hapi監聽客戶端廣播事件</p></li></ul></dd>
744
-
745
-
746
-
747
- <dt class="tag-source">Source:</dt>
748
- <dd class="tag-source"><ul class="dummy"><li>
749
- <a href="WConverhpServer.mjs.html">WConverhpServer.mjs</a>, <a href="WConverhpServer.mjs.html#line493">line 493</a>
750
- </li></ul></dd>
751
-
752
-
753
-
754
-
755
-
756
-
757
-
758
-
759
-
760
-
761
-
762
-
763
-
764
-
765
-
766
-
767
-
768
-
769
-
770
-
771
-
772
-
773
-
774
-
775
-
776
-
777
-
778
-
779
-
780
-
781
-
782
- </dl>
783
-
784
-
785
-
786
-
787
-
788
-
789
-
790
-
791
-
792
-
793
-
794
- <h5 class="h5-examples">Example</h5>
795
-
796
- <pre class="prettyprint"><code>wo.on('broadcast', function(data) {
797
288
  ...
798
-
799
-
800
-
801
-
802
- <h5 class="h5-parameters">Parameters:</h5>
803
-
804
-
805
- <table class="params">
806
- <thead>
807
- <tr>
808
-
809
- <th>Name</th>
810
-
811
-
812
- <th>Type</th>
813
-
814
-
815
-
816
-
817
-
818
- <th class="last">Description</th>
819
- </tr>
820
- </thead>
821
-
822
- <tbody>
823
-
824
-
825
- <tr>
826
-
827
- <td class="name"><code>data</code></td>
828
-
829
-
830
- <td class="type">
831
-
832
-
833
- <span class="param-type">*</span>
834
-
835
-
836
-
837
-
838
- </td>
839
-
840
-
841
-
842
-
843
-
844
- <td class="description last"><p>傳入廣播訊息</p></td>
845
- </tr>
846
-
847
-
848
- </tbody>
849
- </table>
850
-
851
-
852
-
853
-
854
-
855
-
856
-
857
-
858
-
859
-
860
-
861
-
862
-
863
-
864
-
865
-
866
-
867
-
868
-
869
-
870
-
871
-
872
-
873
-
874
- <h4 class="name" id=".onClientChange"><span class="type-signature type-signature-static">(static) </span>onClientChange<span class="signature">()</span><span class="type-signature"></span></h4>
875
-
876
-
877
-
878
-
879
-
880
-
881
- <dl class="details">
882
-
883
- <dt class="tag-description">Description:</dt>
884
- <dd class="tag-description"><ul class="dummy"><li><p>Hapi監聽客戶端變更(上下線)事件</p></li></ul></dd>
885
-
886
-
887
-
888
- <dt class="tag-source">Source:</dt>
889
- <dd class="tag-source"><ul class="dummy"><li>
890
- <a href="WConverhpServer.mjs.html">WConverhpServer.mjs</a>, <a href="WConverhpServer.mjs.html#line261">line 261</a>
891
- </li></ul></dd>
892
-
893
-
894
-
895
-
896
-
897
-
898
-
899
-
900
-
901
-
902
-
903
-
904
-
905
-
906
-
907
-
908
-
909
-
910
-
911
-
912
-
913
-
914
-
915
-
916
-
917
-
918
-
919
-
920
-
921
-
922
-
923
- </dl>
924
-
925
-
926
-
927
-
928
-
929
-
930
-
931
-
932
-
933
-
934
-
935
- <h5 class="h5-examples">Example</h5>
936
-
937
- <pre class="prettyprint"><code>wo.on('clientChange', function(num) {
938
289
  ...
939
-
940
-
941
-
942
-
943
-
944
-
945
-
946
-
947
-
948
-
949
-
950
-
951
-
952
-
953
-
954
-
955
-
956
-
957
-
958
-
959
-
960
-
961
-
962
-
963
-
964
-
965
- <h4 class="name" id=".onClientEnter"><span class="type-signature type-signature-static">(static) </span>onClientEnter<span class="signature">(clientId, data)</span><span class="type-signature"></span></h4>
966
-
967
-
968
-
969
-
970
-
971
-
972
- <dl class="details">
973
-
974
- <dt class="tag-description">Description:</dt>
975
- <dd class="tag-description"><ul class="dummy"><li><p>Hapi監聽客戶端上線事件</p></li></ul></dd>
976
-
977
-
978
-
979
- <dt class="tag-source">Source:</dt>
980
- <dd class="tag-source"><ul class="dummy"><li>
981
- <a href="WConverhpServer.mjs.html">WConverhpServer.mjs</a>, <a href="WConverhpServer.mjs.html#line241">line 241</a>
982
- </li></ul></dd>
983
-
984
-
985
-
986
-
987
-
988
-
989
-
990
-
991
-
992
-
993
-
994
-
995
-
996
-
997
-
998
-
999
-
1000
-
1001
-
1002
-
1003
-
1004
-
1005
-
1006
-
1007
-
1008
-
1009
-
1010
-
1011
-
1012
-
1013
-
1014
- </dl>
1015
-
1016
-
1017
-
1018
-
1019
-
1020
-
1021
-
1022
-
1023
-
1024
-
1025
-
1026
- <h5 class="h5-examples">Example</h5>
1027
-
1028
- <pre class="prettyprint"><code>wo.on('clientEnter', function(clientId, data) {
1029
290
  ...
1030
-
1031
-
1032
-
1033
-
1034
- <h5 class="h5-parameters">Parameters:</h5>
1035
-
1036
-
1037
- <table class="params">
1038
- <thead>
1039
- <tr>
1040
-
1041
- <th>Name</th>
1042
-
1043
-
1044
- <th>Type</th>
1045
-
1046
-
1047
-
1048
-
1049
-
1050
- <th class="last">Description</th>
1051
- </tr>
1052
- </thead>
1053
-
1054
- <tbody>
1055
-
1056
-
1057
- <tr>
1058
-
1059
- <td class="name"><code>clientId</code></td>
1060
-
1061
-
1062
- <td class="type">
1063
-
1064
-
1065
- <span class="param-type">String</span>
1066
-
1067
-
1068
-
1069
-
1070
- </td>
1071
-
1072
-
1073
-
1074
-
1075
-
1076
- <td class="description last"><p>識別用使用者主鍵</p></td>
1077
- </tr>
1078
-
1079
-
1080
-
1081
- <tr>
1082
-
1083
- <td class="name"><code>data</code></td>
1084
-
1085
-
1086
- <td class="type">
1087
-
1088
-
1089
- <span class="param-type">*</span>
1090
-
1091
-
1092
-
1093
-
1094
- </td>
1095
-
1096
-
1097
-
1098
-
1099
-
1100
- <td class="description last"><p>使用者request訊息</p></td>
1101
- </tr>
1102
-
1103
-
1104
- </tbody>
1105
- </table>
1106
-
1107
-
1108
-
1109
-
1110
-
1111
-
1112
-
1113
-
1114
-
1115
-
1116
-
1117
-
1118
-
1119
-
1120
-
1121
-
1122
-
1123
-
1124
-
1125
-
1126
-
1127
-
1128
-
1129
-
1130
- <h4 class="name" id=".onClientLeave"><span class="type-signature type-signature-static">(static) </span>onClientLeave<span class="signature">()</span><span class="type-signature"></span></h4>
1131
-
1132
-
1133
-
1134
-
1135
-
1136
-
1137
- <dl class="details">
1138
-
1139
- <dt class="tag-description">Description:</dt>
1140
- <dd class="tag-description"><ul class="dummy"><li><p>Hapi監聽客戶端下線事件</p></li></ul></dd>
1141
-
1142
-
1143
-
1144
- <dt class="tag-source">Source:</dt>
1145
- <dd class="tag-source"><ul class="dummy"><li>
1146
- <a href="WConverhpServer.mjs.html">WConverhpServer.mjs</a>, <a href="WConverhpServer.mjs.html#line251">line 251</a>
1147
- </li></ul></dd>
1148
-
1149
-
1150
-
1151
-
1152
-
1153
-
1154
-
1155
-
1156
-
1157
-
1158
-
1159
-
1160
-
1161
-
1162
-
1163
-
1164
-
1165
-
1166
-
1167
-
1168
-
1169
-
1170
-
1171
-
1172
-
1173
-
1174
-
1175
-
1176
-
1177
-
1178
-
1179
- </dl>
1180
-
1181
-
1182
-
1183
-
1184
-
1185
-
1186
-
1187
-
1188
-
1189
-
1190
-
1191
- <h5 class="h5-examples">Example</h5>
1192
-
1193
- <pre class="prettyprint"><code>wo.on('clientLeave', function(clientId, data) {
1194
291
  ...
1195
-
1196
-
1197
-
1198
-
1199
-
1200
-
1201
-
1202
-
1203
-
1204
-
1205
-
1206
-
1207
-
1208
-
1209
-
1210
-
1211
-
1212
-
1213
-
1214
-
1215
-
1216
-
1217
-
1218
-
1219
-
1220
-
1221
- <h4 class="name" id=".onDeliver"><span class="type-signature type-signature-static">(static) </span>onDeliver<span class="signature">(data)</span><span class="type-signature"></span></h4>
1222
-
1223
-
1224
-
1225
-
1226
-
1227
-
1228
- <dl class="details">
1229
-
1230
- <dt class="tag-description">Description:</dt>
1231
- <dd class="tag-description"><ul class="dummy"><li><p>Hapi監聽客戶端發送事件</p></li></ul></dd>
1232
-
1233
-
1234
-
1235
- <dt class="tag-source">Source:</dt>
1236
- <dd class="tag-source"><ul class="dummy"><li>
1237
- <a href="WConverhpServer.mjs.html">WConverhpServer.mjs</a>, <a href="WConverhpServer.mjs.html#line506">line 506</a>
1238
- </li></ul></dd>
1239
-
1240
-
1241
-
1242
-
1243
-
1244
-
1245
-
1246
-
1247
-
1248
-
1249
-
1250
-
1251
-
1252
-
1253
-
1254
-
1255
-
1256
-
1257
-
1258
-
1259
-
1260
-
1261
-
1262
-
1263
-
1264
-
1265
-
1266
-
1267
-
1268
-
1269
-
1270
- </dl>
1271
-
1272
-
1273
-
1274
-
1275
-
1276
-
1277
-
1278
-
1279
-
1280
-
1281
-
1282
- <h5 class="h5-examples">Example</h5>
1283
-
1284
- <pre class="prettyprint"><code>wo.on('deliver', function(data) {
1285
292
  ...
1286
-
1287
-
1288
-
1289
-
1290
- <h5 class="h5-parameters">Parameters:</h5>
1291
-
1292
-
1293
- <table class="params">
1294
- <thead>
1295
- <tr>
1296
-
1297
- <th>Name</th>
1298
-
1299
-
1300
- <th>Type</th>
1301
-
1302
-
1303
-
1304
-
1305
-
1306
- <th class="last">Description</th>
1307
- </tr>
1308
- </thead>
1309
-
1310
- <tbody>
1311
-
1312
-
1313
- <tr>
1314
-
1315
- <td class="name"><code>data</code></td>
1316
-
1317
-
1318
- <td class="type">
1319
-
1320
-
1321
- <span class="param-type">*</span>
1322
-
1323
-
1324
-
1325
-
1326
- </td>
1327
-
1328
-
1329
-
1330
-
1331
-
1332
- <td class="description last"><p>傳入發送訊息</p></td>
1333
- </tr>
1334
-
1335
-
1336
- </tbody>
1337
- </table>
1338
-
1339
-
1340
-
1341
-
1342
-
1343
-
1344
-
1345
-
1346
-
1347
-
1348
-
1349
-
1350
-
1351
-
1352
-
1353
-
1354
-
1355
-
1356
-
1357
-
1358
-
1359
-
1360
-
1361
-
1362
- <h4 class="name" id=".onError"><span class="type-signature type-signature-static">(static) </span>onError<span class="signature">(err)</span><span class="type-signature"></span></h4>
1363
-
1364
-
1365
-
1366
-
1367
-
1368
-
1369
- <dl class="details">
1370
-
1371
- <dt class="tag-description">Description:</dt>
1372
- <dd class="tag-description"><ul class="dummy"><li><p>Hapi監聽錯誤事件</p></li></ul></dd>
1373
-
1374
-
1375
-
1376
- <dt class="tag-source">Source:</dt>
1377
- <dd class="tag-source"><ul class="dummy"><li>
1378
- <a href="WConverhpServer.mjs.html">WConverhpServer.mjs</a>, <a href="WConverhpServer.mjs.html#line224">line 224</a>
1379
- </li></ul></dd>
1380
-
1381
-
1382
-
1383
-
1384
-
1385
-
1386
-
1387
-
1388
-
1389
-
1390
-
1391
-
1392
-
1393
-
1394
-
1395
-
1396
-
1397
-
1398
-
1399
-
1400
-
1401
-
1402
-
1403
-
1404
-
1405
-
1406
-
1407
-
1408
-
1409
-
1410
-
1411
- </dl>
1412
-
1413
-
1414
-
1415
-
1416
-
1417
-
1418
-
1419
-
1420
-
1421
-
1422
-
1423
- <h5 class="h5-examples">Example</h5>
1424
-
1425
- <pre class="prettyprint"><code>wo.on('error', function(err) {
1426
293
  ...
1427
-
1428
-
1429
-
1430
-
1431
- <h5 class="h5-parameters">Parameters:</h5>
1432
-
1433
-
1434
- <table class="params">
1435
- <thead>
1436
- <tr>
1437
-
1438
- <th>Name</th>
1439
-
1440
-
1441
- <th>Type</th>
1442
-
1443
-
1444
-
1445
-
1446
-
1447
- <th class="last">Description</th>
1448
- </tr>
1449
- </thead>
1450
-
1451
- <tbody>
1452
-
1453
-
1454
- <tr>
1455
-
1456
- <td class="name"><code>err</code></td>
1457
-
1458
-
1459
- <td class="type">
1460
-
1461
-
1462
- <span class="param-type">*</span>
1463
-
1464
-
1465
-
1466
-
1467
- </td>
1468
-
1469
-
1470
-
1471
-
1472
-
1473
- <td class="description last"><p>傳入錯誤訊息</p></td>
1474
- </tr>
1475
-
1476
-
1477
- </tbody>
1478
- </table>
1479
-
1480
-
1481
-
1482
-
1483
-
1484
-
1485
-
1486
-
1487
-
1488
-
1489
-
1490
-
1491
-
1492
-
1493
-
1494
-
1495
-
1496
-
1497
-
1498
-
1499
-
1500
-
1501
-
1502
-
1503
- <h4 class="name" id=".onExecute"><span class="type-signature type-signature-static">(static) </span>onExecute<span class="signature">(func, input, callback, sendData)</span><span class="type-signature"></span></h4>
1504
-
1505
-
1506
-
1507
-
1508
-
1509
-
1510
- <dl class="details">
1511
-
1512
- <dt class="tag-description">Description:</dt>
1513
- <dd class="tag-description"><ul class="dummy"><li><p>Hapi監聽客戶端執行事件</p></li></ul></dd>
1514
-
1515
-
1516
-
1517
- <dt class="tag-source">Source:</dt>
1518
- <dd class="tag-source"><ul class="dummy"><li>
1519
- <a href="WConverhpServer.mjs.html">WConverhpServer.mjs</a>, <a href="WConverhpServer.mjs.html#line480">line 480</a>
1520
- </li></ul></dd>
1521
-
1522
-
1523
-
1524
-
1525
-
1526
-
1527
-
1528
-
1529
-
1530
-
1531
-
1532
-
1533
-
1534
-
1535
-
1536
-
1537
-
1538
-
1539
-
1540
-
1541
-
1542
-
1543
-
1544
-
1545
-
1546
-
1547
-
1548
-
1549
-
1550
-
1551
-
1552
- </dl>
1553
-
1554
-
1555
-
1556
-
1557
-
1558
-
1559
-
1560
-
294
+
295
+ </td>
296
+
1561
297
 
298
+
299
+ <td class="default">
300
+
301
+ <code>true</code>
302
+
303
+ </td>
304
+
1562
305
 
306
+ <td class="description last"><p>輸入是否提供瀏覽pathStaticFiles資料夾內檔案之布林值,預設true</p></td>
307
+ </tr>
1563
308
 
1564
- <h5 class="h5-examples">Example</h5>
1565
309
 
1566
- <pre class="prettyprint"><code>wo.on('execute', function(func, input, callback, sendData) {
1567
310
  ...
1568
311
 
312
+ <tr>
313
+
314
+ <td class="name"><code>pathStaticFiles</code></td>
315
+
1569
316
 
317
+ <td class="type">
318
+
319
+
320
+ <span class="param-type">String</span>
1570
321
 
1571
322
 
1572
- <h5 class="h5-parameters">Parameters:</h5>
1573
-
1574
323
 
1575
- <table class="params">
1576
- <thead>
1577
- <tr>
1578
-
1579
- <th>Name</th>
1580
-
324
+
325
+ </td>
1581
326
 
1582
- <th>Type</th>
327
+
328
+ <td class="attributes">
329
+
330
+ &lt;optional><br>
331
+
1583
332
 
1584
-
333
+
1585
334
 
1586
-
335
+
336
+ </td>
337
+
1587
338
 
1588
- <th class="last">Description</th>
1589
- </tr>
1590
- </thead>
339
+
340
+ <td class="default">
341
+
342
+ <code>'dist'</code>
343
+
344
+ </td>
345
+
346
+
347
+ <td class="description last"><p>輸入當useInert=true時提供瀏覽資料夾字串,預設'dist'</p></td>
348
+ </tr>
1591
349
 
1592
- <tbody>
1593
350
 
1594
351
 
1595
352
  <tr>
1596
353
 
1597
- <td class="name"><code>func</code></td>
354
+ <td class="name"><code>apiName</code></td>
1598
355
 
1599
356
 
1600
357
  <td class="type">
@@ -1601,23 +358,39 @@
1601
358
  </td>
1602
359
 
1603
360
 
361
+ <td class="attributes">
362
+
363
+ &lt;optional><br>
364
+
365
+
366
+
367
+
368
+
369
+ </td>
370
+
1604
371
 
1605
372
 
373
+ <td class="default">
374
+
375
+ <code>'api'</code>
376
+
377
+ </td>
378
+
1606
379
 
1607
- <td class="description last"><p>傳入執行函數名稱字串</p></td>
380
+ <td class="description last"><p>輸入API名稱字串,預設'api'</p></td>
1608
381
  </tr>
1609
382
 
1610
383
 
1611
384
 
1612
385
  <tr>
1613
386
 
1614
- <td class="name"><code>input</code></td>
387
+ <td class="name"><code>pathUploadTemp</code></td>
1615
388
 
1616
389
 
1617
390
  <td class="type">
1618
391
 
1619
392
 
1620
- <span class="param-type">*</span>
393
+ <span class="param-type">String</span>
1621
394
 
1622
395
 
1623
396
 
@@ -1625,17 +398,33 @@
1625
398
  </td>
1626
399
 
1627
400
 
401
+ <td class="attributes">
402
+
403
+ &lt;optional><br>
404
+
405
+
406
+
407
+
408
+
409
+ </td>
410
+
1628
411
 
1629
412
 
413
+ <td class="default">
414
+
415
+ <code>'./uploadTemp'</code>
416
+
417
+ </td>
418
+
1630
419
 
1631
- <td class="description last"><p>傳入執行函數之輸入數據</p></td>
420
+ <td class="description last"><p>輸入暫時存放切片上傳檔案資料夾字串,預設'./uploadTemp'</p></td>
1632
421
  </tr>
1633
422
 
1634
423
 
1635
424
 
1636
425
  <tr>
1637
426
 
1638
- <td class="name"><code>callback</code></td>
427
+ <td class="name"><code>funCheck</code></td>
1639
428
 
1640
429
 
1641
430
  <td class="type">
@@ -1649,23 +438,39 @@
1649
438
  </td>
1650
439
 
1651
440
 
441
+ <td class="attributes">
442
+
443
+ &lt;optional><br>
444
+
445
+
446
+
447
+
448
+
449
+ </td>
450
+
1652
451
 
1653
452
 
453
+ <td class="default">
454
+
455
+ <code>()=>{return true}</code>
456
+
457
+ </td>
458
+
1654
459
 
1655
- <td class="description last"><p>傳入執行函數之回調函數</p></td>
460
+ <td class="description last"><p>輸入呼叫API時檢測函數,預設()=&gt;{return true}</p></td>
1656
461
  </tr>
1657
462
 
1658
463
 
1659
464
 
1660
465
  <tr>
1661
466
 
1662
- <td class="name"><code>sendData</code></td>
467
+ <td class="name"><code>corsOrigins</code></td>
1663
468
 
1664
469
 
1665
470
  <td class="type">
1666
471
 
1667
472
 
1668
- <span class="param-type">function</span>
473
+ <span class="param-type">Array</span>
1669
474
 
1670
475
 
1671
476
 
@@ -1673,89 +478,160 @@
1673
478
  </td>
1674
479
 
1675
480
 
481
+ <td class="attributes">
482
+
483
+ &lt;optional><br>
484
+
485
+
486
+
487
+
488
+
489
+ </td>
490
+
1676
491
 
1677
492
 
493
+ <td class="default">
494
+
495
+ <code>['*']</code>
496
+
497
+ </td>
498
+
1678
499
 
1679
- <td class="description last"><p>傳入執行函數之強制回傳函數,提供傳送任意訊息給客戶端,供由服器多次回傳數據之用</p></td>
500
+ <td class="description last"><p>輸入允許跨域網域陣列,若給予['<em>']代表允許全部,預設['</em>']</p></td>
1680
501
  </tr>
1681
502
 
1682
503
 
1683
- </tbody>
1684
- </table>
1685
-
1686
-
1687
-
1688
504
 
505
+ <tr>
506
+
507
+ <td class="name"><code>delayForBasic</code></td>
508
+
1689
509
 
510
+ <td class="type">
511
+
512
+
513
+ <span class="param-type">Integer</span>
1690
514
 
1691
515
 
1692
516
 
517
+
518
+ </td>
1693
519
 
520
+
521
+ <td class="attributes">
522
+
523
+ &lt;optional><br>
524
+
1694
525
 
526
+
1695
527
 
528
+
529
+ </td>
530
+
1696
531
 
532
+
533
+ <td class="default">
534
+
535
+ <code>0</code>
536
+
537
+ </td>
538
+
1697
539
 
540
+ <td class="description last"><p>輸入基本API用延遲響應時間,單位ms,預設0</p></td>
541
+ </tr>
1698
542
 
543
+
1699
544
 
545
+ <tr>
546
+
547
+ <td class="name"><code>delayForSlice</code></td>
548
+
1700
549
 
550
+ <td class="type">
551
+
552
+
553
+ <span class="param-type">Integer</span>
1701
554
 
1702
555
 
1703
556
 
1704
-
1705
557
 
558
+ </td>
1706
559
 
1707
-
1708
-
1709
- <h4 class="name" id=".onOpen"><span class="type-signature type-signature-static">(static) </span>onOpen<span class="signature">()</span><span class="type-signature"></span></h4>
1710
-
1711
-
560
+
561
+ <td class="attributes">
562
+
563
+ &lt;optional><br>
564
+
1712
565
 
566
+
1713
567
 
568
+
569
+ </td>
570
+
1714
571
 
572
+
573
+ <td class="default">
574
+
575
+ <code>100</code>
576
+
577
+ </td>
578
+
1715
579
 
1716
- <dl class="details">
1717
-
1718
- <dt class="tag-description">Description:</dt>
1719
- <dd class="tag-description"><ul class="dummy"><li><p>Hapi監聽開啟事件</p></li></ul></dd>
1720
-
580
+ <td class="description last"><p>輸入切片上傳檔案API用延遲響應時間,單位ms,預設100</p></td>
581
+ </tr>
1721
582
 
1722
583
 
1723
- <dt class="tag-source">Source:</dt>
1724
- <dd class="tag-source"><ul class="dummy"><li>
1725
- <a href="WConverhpServer.mjs.html">WConverhpServer.mjs</a>, <a href="WConverhpServer.mjs.html#line207">line 207</a>
1726
- </li></ul></dd>
1727
-
1728
584
 
1729
-
585
+ <tr>
586
+
587
+ <td class="name"><code>serverHapi</code></td>
588
+
1730
589
 
1731
-
590
+ <td class="type">
591
+
592
+
593
+ <span class="param-type">Boolean</span>
1732
594
 
1733
-
1734
595
 
1735
-
1736
596
 
1737
-
597
+
598
+ </td>
1738
599
 
1739
-
600
+
601
+ <td class="attributes">
602
+
603
+ &lt;optional><br>
604
+
1740
605
 
1741
-
606
+
1742
607
 
1743
-
608
+
609
+ </td>
610
+
1744
611
 
1745
-
612
+
613
+ <td class="default">
614
+
615
+ <code>null</code>
616
+
617
+ </td>
618
+
1746
619
 
1747
-
620
+ <td class="description last"><p>輸入外部提供Hapi伺服器物件,預設null</p></td>
621
+ </tr>
1748
622
 
1749
623
 
624
+ </tbody>
625
+ </table>
1750
626
 
1751
-
627
+ </td>
628
+ </tr>
1752
629
 
1753
630
 
631
+ </tbody>
632
+ </table>
1754
633
 
1755
-
1756
634
 
1757
-
1758
- </dl>
1759
635
 
1760
636
 
1761
637
 
@@ -1767,31 +643,53 @@
1767
643
 
1768
644
 
1769
645
 
1770
- <h5 class="h5-examples">Example</h5>
1771
-
1772
- <pre class="prettyprint"><code>wo.on('open', function() {
1773
646
  ...
1774
647
 
1775
648
 
1776
649
 
650
+ <h5 class="h5-returns">Returns:</h5>
1777
651
 
652
+
653
+ <div class="param-desc">
654
+ <p>回傳通訊物件,可監聽事件execute、upload、handler</p>
655
+ </div>
1778
656
 
1779
657
 
1780
658
 
659
+ <dl class="param-type">
660
+ <dt>
661
+ Type
662
+ </dt>
663
+ <dd>
664
+
665
+ <span class="param-type">Object</span>
1781
666
 
1782
667
 
1783
668
 
669
+ </dd>
670
+ </dl>
1784
671
 
672
+
1785
673
 
1786
674
 
1787
675
 
676
+
677
+ </div>
678
+
1788
679
 
680
+
1789
681
 
682
+
1790
683
 
684
+
685
+
686
+
1791
687
 
688
+
1792
689
 
690
+
1793
691
 
692
+
1794
693
 
1795
-
1796
694
 
1797
695
 
1798
696
 
@@ -1811,7 +709,7 @@
1811
709
  <br class="clear">
1812
710
 
1813
711
  <footer>
1814
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Sun Mar 24 2024 22:49:11 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
712
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Mon Mar 03 2025 12:11:13 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1815
713
  </footer>
1816
714
 
1817
715
  <script>prettyPrint();</script>