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="WConverhpClient.mjs.html">WConverhpClient.mjs</a>, <a href="WConverhpClient.mjs.html#line112">line 112</a>
83
+ <a href="WConverhpClient.mjs.html">WConverhpClient.mjs</a>, <a href="WConverhpClient.mjs.html#line132">line 132</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 WConverhpClient from 'w-converhp/dist/w-converhp-client.umd.js'
131
130
  url: 'http://localhost:8080',
132
131
  apiName: 'api',
133
132
  console.log('client nodejs: open')
134
133
  console.log('client nodejs: openOnce')
135
134
  //p
136
135
  let name = 'zdata.b1'
137
136
  let p = {
138
137
  a: 12,
139
138
  b: 34.56,
140
139
  c: 'test中文',
141
140
  d: {
142
141
  name: name,
143
142
  u8a: new Uint8Array([66, 97, 115]),
144
143
  //u8a: new Uint8Array(fs.readFileSync('C:\\Users\\Administrator\\Desktop\\'+name)),
145
144
  }
146
145
  }
147
146
  //execute
148
147
  wo.execute('add', { p },
149
148
  function (prog, p, m) {
150
149
  console.log('client nodejs: execute: prog', prog, p, m)
151
150
  })
152
151
  .then(function(r) {
153
152
  console.log('client nodejs: execute: add', r)
154
153
  })
155
154
  .catch(function(err) {
156
155
  console.log('client nodejs: execute: catch', err)
157
156
  })
158
157
  //broadcast
159
158
  wo.broadcast('client nodejs broadcast hi', function (prog) {
160
159
  console.log('client nodejs: broadcast: prog', prog)
161
160
  })
162
161
  .catch(function(err) {
163
162
  console.log('client nodejs: broadcast: catch', err)
164
163
  })
165
164
  //deliver
166
165
  wo.deliver('client nodejs deliver hi', function (prog) {
167
166
  console.log('client nodejs: deliver: prog', prog)
168
167
  })
169
168
  .catch(function(err) {
170
169
  console.log('client nodejs: deliver: catch', err)
171
170
  })
172
171
  console.log('client nodejs: close')
173
172
  console.log('client nodejs: error', err)
174
173
  console.log('client nodejs: reconn')
175
174
  console.log('client nodejs: broadcast', data)
176
175
  console.log('client nodejs: deliver', data)
176
+ <pre class="prettyprint"><code>import WConverhpClient from 'w-converhp/dist/w-converhp-client.umd.js'
177
177
  FormData,
178
178
  url: 'http://localhost:8080',
179
179
  apiName: 'api',
180
180
  //p
181
181
  let p = {
182
182
  a: 12,
183
183
  b: 34.56,
184
184
  c: 'test中文',
185
185
  d: {
186
186
  name,
187
187
  u8a,
188
188
  },
189
189
  }
190
190
  console.log('p', p)
191
191
  //execute
192
192
  await wo.execute('add', { p },
193
193
  function (prog, p, m) {
194
194
  console.log('client web: execute: prog', prog, p, m)
195
195
  })
196
196
  .then(function(r) {
197
197
  console.log('client web: execute: add', r)
198
198
  console.log('r._bin.name', r._bin.name, 'r._bin.u8a', r._bin.u8a)
199
199
  // w.downloadFileFromU8Arr(r._bin.name, r._bin.u8a)
200
200
  })
201
201
  .catch(function (err) {
202
202
  console.log('client web: execute: catch', err)
203
203
  })
204
204
  let core = async() => {
205
205
  //u8a
206
206
  let u8a = new Uint8Array([66, 97, 115])
207
207
  console.log('executeWithU8a u8a', u8a)
208
208
  //execute
209
209
  await execute('zdata.b1', u8a)
210
210
  }
211
211
  core()
212
212
  let core = async() => {
213
213
  //u8a
214
214
  let u8a = new Uint8Array(fs.readFileSync('../_data/10mb.7z'))
215
215
  console.log('executeWithFile u8a', u8a)
216
216
  //execute
217
217
  await execute('10mb.7z', u8a)
218
218
  }
219
219
  core()
220
220
  let core = async() => {
221
221
  //u8a
222
222
  let u8a = new Uint8Array(fs.readFileSync('../_data/1000mb.7z'))
223
223
  console.log('u8a.length', u8a.length)
224
224
  console.log('uploadLargeFile u8a', u8a)
225
225
  await wo.upload('1000mb.7z', u8a,
226
226
  function (prog, p, m) {
227
227
  console.log('client web: upload: prog', prog, p, m)
228
228
  })
229
229
  .then(function(res) {
230
230
  console.log('client web: upload: then', res)
231
231
  })
232
232
  .catch(function (err) {
233
233
  console.log('client web: upload: catch', err)
234
234
  })
235
235
  }
236
236
  core()
237
237
 
238
238
 
239
239
 
@@ -277,14 +277,14 @@
277
277
  </td>
278
278
 
279
279
 
280
- <td class="description last"><p>輸入api名稱,預設為'api'</p></td>
280
+ <td class="description last"><p>輸入API名稱字串,預設'api'</p></td>
281
281
  </tr>
282
282
 
283
283
 
284
284
 
285
285
  <tr>
286
286
 
287
- <td class="name"><code>timePolling</code></td>
287
+ <td class="name"><code>sizeSlice</code></td>
288
288
 
289
289
 
290
290
  <td class="type">
@@ -312,12 +312,12 @@
312
312
 
313
313
  <td class="default">
314
314
 
315
- <code>2000</code>
315
+ <code>1024*1024</code>
316
316
 
317
317
  </td>
318
318
 
319
319
 
320
- <td class="description last"><p>輸入輪詢間隔時間整數,單位為毫秒,預設為2000</p></td>
320
+ <td class="description last"><p>輸入切片上傳檔案之切片檔案大小整數,單位為Byte,預設為1024*1024</p></td>
321
321
  </tr>
322
322
 
323
323
 
@@ -390,7 +390,7 @@
390
390
 
391
391
 
392
392
  <div class="param-desc">
393
- <p>回傳通訊物件,可監聽事件open、openOnce、close、error、reconn、broadcast、deliver,可使用函數execute、broadcast、deliver</p>
393
+ <p>回傳通訊物件,可使用函數execute、upload</p>
394
394
  </div>
395
395
 
396
396
 
@@ -430,806 +430,6 @@
430
430
 
431
431
 
432
432
 
433
-
434
- <h3 class="subsection-title">Methods</h3>
435
-
436
-
437
-
438
-
439
-
440
-
441
- <h4 class="name" id=".broadcast"><span class="type-signature type-signature-static">(static) </span>broadcast<span class="signature">(data)</span><span class="type-signature"></span></h4>
442
-
443
-
444
-
445
-
446
-
447
-
448
- <dl class="details">
449
-
450
- <dt class="tag-description">Description:</dt>
451
- <dd class="tag-description"><ul class="dummy"><li><p>Hapi通訊物件對伺服器端廣播函數,表示傳送資料給伺服器,還需轉送其他客戶端</p></li></ul></dd>
452
-
453
-
454
-
455
- <dt class="tag-source">Source:</dt>
456
- <dd class="tag-source"><ul class="dummy"><li>
457
- <a href="WConverhpClient.mjs.html">WConverhpClient.mjs</a>, <a href="WConverhpClient.mjs.html#line628">line 628</a>
458
- </li></ul></dd>
459
-
460
-
461
-
462
-
463
-
464
-
465
-
466
-
467
-
468
-
469
-
470
-
471
-
472
-
473
-
474
-
475
-
476
-
477
-
478
-
479
-
480
-
481
-
482
-
483
-
484
-
485
-
486
-
487
-
488
-
489
-
490
- </dl>
491
-
492
-
493
-
494
-
495
-
496
-
497
-
498
-
499
-
500
-
501
-
502
- <h5 class="h5-examples">Example</h5>
503
-
504
- <pre class="prettyprint"><code>let data = {...}
505
-
506
-
507
-
508
-
509
- <h5 class="h5-parameters">Parameters:</h5>
510
-
511
-
512
- <table class="params">
513
- <thead>
514
- <tr>
515
-
516
- <th>Name</th>
517
-
518
-
519
- <th>Type</th>
520
-
521
-
522
-
523
-
524
-
525
- <th class="last">Description</th>
526
- </tr>
527
- </thead>
528
-
529
- <tbody>
530
-
531
-
532
- <tr>
533
-
534
- <td class="name"><code>data</code></td>
535
-
536
-
537
- <td class="type">
538
-
539
-
540
- <span class="param-type">*</span>
541
-
542
-
543
-
544
-
545
- </td>
546
-
547
-
548
-
549
-
550
-
551
- <td class="description last"><p>輸入廣播函數之輸入資訊</p></td>
552
- </tr>
553
-
554
-
555
- </tbody>
556
- </table>
557
-
558
-
559
-
560
-
561
-
562
-
563
-
564
-
565
-
566
-
567
-
568
-
569
-
570
-
571
-
572
-
573
-
574
-
575
-
576
-
577
-
578
-
579
-
580
-
581
- <h4 class="name" id=".deliver"><span class="type-signature type-signature-static">(static) </span>deliver<span class="signature">(data)</span><span class="type-signature"></span></h4>
582
-
583
-
584
-
585
-
586
-
587
-
588
- <dl class="details">
589
-
590
- <dt class="tag-description">Description:</dt>
591
- <dd class="tag-description"><ul class="dummy"><li><p>Hapi通訊物件對伺服器端發送函數,表示僅傳送資料給伺服器</p></li></ul></dd>
592
-
593
-
594
-
595
- <dt class="tag-source">Source:</dt>
596
- <dd class="tag-source"><ul class="dummy"><li>
597
- <a href="WConverhpClient.mjs.html">WConverhpClient.mjs</a>, <a href="WConverhpClient.mjs.html#line650">line 650</a>
598
- </li></ul></dd>
599
-
600
-
601
-
602
-
603
-
604
-
605
-
606
-
607
-
608
-
609
-
610
-
611
-
612
-
613
-
614
-
615
-
616
-
617
-
618
-
619
-
620
-
621
-
622
-
623
-
624
-
625
-
626
-
627
-
628
-
629
-
630
- </dl>
631
-
632
-
633
-
634
-
635
-
636
-
637
-
638
-
639
-
640
-
641
-
642
- <h5 class="h5-examples">Example</h5>
643
-
644
- <pre class="prettyprint"><code>let data = {...}
645
-
646
-
647
-
648
-
649
- <h5 class="h5-parameters">Parameters:</h5>
650
-
651
-
652
- <table class="params">
653
- <thead>
654
- <tr>
655
-
656
- <th>Name</th>
657
-
658
-
659
- <th>Type</th>
660
-
661
-
662
-
663
-
664
-
665
- <th class="last">Description</th>
666
- </tr>
667
- </thead>
668
-
669
- <tbody>
670
-
671
-
672
- <tr>
673
-
674
- <td class="name"><code>data</code></td>
675
-
676
-
677
- <td class="type">
678
-
679
-
680
- <span class="param-type">*</span>
681
-
682
-
683
-
684
-
685
- </td>
686
-
687
-
688
-
689
-
690
-
691
- <td class="description last"><p>輸入發送函數之輸入資訊</p></td>
692
- </tr>
693
-
694
-
695
- </tbody>
696
- </table>
697
-
698
-
699
-
700
-
701
-
702
-
703
-
704
-
705
-
706
-
707
-
708
-
709
-
710
-
711
-
712
-
713
-
714
-
715
-
716
-
717
-
718
-
719
-
720
-
721
- <h4 class="name" id=".execute"><span class="type-signature type-signature-static">(static) </span>execute<span class="signature">(func, input<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
722
-
723
-
724
-
725
-
726
-
727
-
728
- <dl class="details">
729
-
730
- <dt class="tag-description">Description:</dt>
731
- <dd class="tag-description"><ul class="dummy"><li><p>Hapi通訊物件對伺服器端執行函數,表示傳送資料給伺服器,並請伺服器執行函數</p></li></ul></dd>
732
-
733
-
734
-
735
- <dt class="tag-source">Source:</dt>
736
- <dd class="tag-source"><ul class="dummy"><li>
737
- <a href="WConverhpClient.mjs.html">WConverhpClient.mjs</a>, <a href="WConverhpClient.mjs.html#line604">line 604</a>
738
- </li></ul></dd>
739
-
740
-
741
-
742
-
743
-
744
-
745
-
746
-
747
-
748
-
749
-
750
-
751
-
752
-
753
-
754
-
755
-
756
-
757
-
758
-
759
-
760
-
761
-
762
-
763
-
764
-
765
-
766
-
767
-
768
-
769
-
770
- </dl>
771
-
772
-
773
-
774
-
775
-
776
-
777
-
778
-
779
-
780
-
781
-
782
- <h5 class="h5-examples">Example</h5>
783
-
784
- <pre class="prettyprint"><code>let func = 'NameOfFunction'
785
-
786
-
787
-
788
-
789
- <h5 class="h5-parameters">Parameters:</h5>
790
-
791
-
792
- <table class="params">
793
- <thead>
794
- <tr>
795
-
796
- <th>Name</th>
797
-
798
-
799
- <th>Type</th>
800
-
801
-
802
- <th>Attributes</th>
803
-
804
-
805
-
806
- <th>Default</th>
807
-
808
-
809
- <th class="last">Description</th>
810
- </tr>
811
- </thead>
812
-
813
- <tbody>
814
-
815
-
816
- <tr>
817
-
818
- <td class="name"><code>func</code></td>
819
-
820
-
821
- <td class="type">
822
-
823
-
824
- <span class="param-type">String</span>
825
-
826
-
827
-
828
-
829
- </td>
830
-
831
-
832
- <td class="attributes">
833
-
834
-
835
-
836
-
837
-
838
- </td>
839
-
840
-
841
-
842
- <td class="default">
843
-
844
- </td>
845
-
846
-
847
- <td class="description last"><p>輸入執行函數之名稱字串</p></td>
848
- </tr>
849
-
850
-
851
-
852
- <tr>
853
-
854
- <td class="name"><code>input</code></td>
855
-
856
-
857
- <td class="type">
858
-
859
-
860
- <span class="param-type">*</span>
861
-
862
-
863
-
864
-
865
- </td>
866
-
867
-
868
- <td class="attributes">
869
-
870
- &lt;optional><br>
871
-
872
-
873
-
874
-
875
-
876
- </td>
877
-
878
-
879
-
880
- <td class="default">
881
-
882
- <code>null</code>
883
-
884
- </td>
885
-
886
-
887
- <td class="description last"><p>輸入執行函數之輸入資訊</p></td>
888
- </tr>
889
-
890
-
891
- </tbody>
892
- </table>
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
- <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>
918
-
919
-
920
-
921
-
922
-
923
-
924
- <dl class="details">
925
-
926
- <dt class="tag-description">Description:</dt>
927
- <dd class="tag-description"><ul class="dummy"><li><p>Hapi監聽錯誤事件</p></li></ul></dd>
928
-
929
-
930
-
931
- <dt class="tag-source">Source:</dt>
932
- <dd class="tag-source"><ul class="dummy"><li>
933
- <a href="WConverhpClient.mjs.html">WConverhpClient.mjs</a>, <a href="WConverhpClient.mjs.html#line197">line 197</a>
934
- </li></ul></dd>
935
-
936
-
937
-
938
-
939
-
940
-
941
-
942
-
943
-
944
-
945
-
946
-
947
-
948
-
949
-
950
-
951
-
952
-
953
-
954
-
955
-
956
-
957
-
958
-
959
-
960
-
961
-
962
-
963
-
964
-
965
-
966
- </dl>
967
-
968
-
969
-
970
-
971
-
972
-
973
-
974
-
975
-
976
-
977
-
978
- <h5 class="h5-examples">Example</h5>
979
-
980
- <pre class="prettyprint"><code>wo.on('error', function(err) {
981
433
  ...
982
-
983
-
984
-
985
-
986
- <h5 class="h5-parameters">Parameters:</h5>
987
-
988
-
989
- <table class="params">
990
- <thead>
991
- <tr>
992
-
993
- <th>Name</th>
994
-
995
-
996
- <th>Type</th>
997
-
998
-
999
-
1000
-
1001
-
1002
- <th class="last">Description</th>
1003
- </tr>
1004
- </thead>
1005
-
1006
- <tbody>
1007
-
1008
-
1009
- <tr>
1010
-
1011
- <td class="name"><code>err</code></td>
1012
-
1013
-
1014
- <td class="type">
1015
-
1016
-
1017
- <span class="param-type">*</span>
1018
-
1019
-
1020
-
1021
-
1022
- </td>
1023
-
1024
-
1025
-
1026
-
1027
-
1028
- <td class="description last"><p>接收錯誤訊息</p></td>
1029
- </tr>
1030
-
1031
-
1032
- </tbody>
1033
- </table>
1034
-
1035
-
1036
-
1037
-
1038
-
1039
-
1040
-
1041
-
1042
-
1043
-
1044
-
1045
-
1046
-
1047
-
1048
-
1049
-
1050
-
1051
-
1052
-
1053
-
1054
-
1055
-
1056
-
1057
-
1058
- <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>
1059
-
1060
-
1061
-
1062
-
1063
-
1064
-
1065
- <dl class="details">
1066
-
1067
- <dt class="tag-description">Description:</dt>
1068
- <dd class="tag-description"><ul class="dummy"><li><p>Hapi監聽開啟事件</p></li></ul></dd>
1069
-
1070
-
1071
-
1072
- <dt class="tag-source">Source:</dt>
1073
- <dd class="tag-source"><ul class="dummy"><li>
1074
- <a href="WConverhpClient.mjs.html">WConverhpClient.mjs</a>, <a href="WConverhpClient.mjs.html#line166">line 166</a>
1075
- </li></ul></dd>
1076
-
1077
-
1078
-
1079
-
1080
-
1081
-
1082
-
1083
-
1084
-
1085
-
1086
-
1087
-
1088
-
1089
-
1090
-
1091
-
1092
-
1093
-
1094
-
1095
-
1096
-
1097
-
1098
-
1099
-
1100
-
1101
-
1102
-
1103
-
1104
-
1105
-
1106
-
1107
- </dl>
1108
-
1109
-
1110
-
1111
-
1112
-
1113
-
1114
-
1115
-
1116
-
1117
-
1118
-
1119
- <h5 class="h5-examples">Example</h5>
1120
-
1121
- <pre class="prettyprint"><code>wo.on('open', function() {
1122
434
  ...
1123
-
1124
-
1125
-
1126
-
1127
-
1128
-
1129
-
1130
-
1131
-
1132
-
1133
-
1134
-
1135
-
1136
-
1137
-
1138
-
1139
-
1140
-
1141
-
1142
-
1143
-
1144
-
1145
-
1146
-
1147
-
1148
-
1149
- <h4 class="name" id=".onOpenOnce"><span class="type-signature type-signature-static">(static) </span>onOpenOnce<span class="signature">()</span><span class="type-signature"></span></h4>
1150
-
1151
-
1152
-
1153
-
1154
-
1155
-
1156
- <dl class="details">
1157
-
1158
- <dt class="tag-description">Description:</dt>
1159
- <dd class="tag-description"><ul class="dummy"><li><p>Hapi監聽第一次開啟事件</p></li></ul></dd>
1160
-
1161
-
1162
-
1163
- <dt class="tag-source">Source:</dt>
1164
- <dd class="tag-source"><ul class="dummy"><li>
1165
- <a href="WConverhpClient.mjs.html">WConverhpClient.mjs</a>, <a href="WConverhpClient.mjs.html#line181">line 181</a>
1166
- </li></ul></dd>
1167
-
1168
-
1169
-
1170
-
1171
-
1172
-
1173
-
1174
-
1175
-
1176
-
1177
-
1178
-
1179
-
1180
-
1181
-
1182
-
1183
-
1184
-
1185
-
1186
-
1187
-
1188
-
1189
-
1190
-
1191
-
1192
-
1193
-
1194
-
1195
-
1196
-
1197
-
1198
- </dl>
1199
-
1200
-
1201
-
1202
-
1203
-
1204
-
1205
-
1206
-
1207
-
1208
-
1209
-
1210
- <h5 class="h5-examples">Example</h5>
1211
-
1212
- <pre class="prettyprint"><code>wo.on('openOnce', function() {
1213
435
  ...
1214
-
1215
-
1216
-
1217
-
1218
-
1219
-
1220
-
1221
-
1222
-
1223
-
1224
-
1225
-
1226
-
1227
-
1228
-
1229
-
1230
-
1231
-
1232
-
1233
-
1234
-
1235
-
1236
436
 
1237
437
 
1238
438
 
@@ -1249,7 +449,7 @@
1249
449
  <br class="clear">
1250
450
 
1251
451
  <footer>
1252
- 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.
452
+ 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.
1253
453
  </footer>
1254
454
 
1255
455
  <script>prettyPrint();</script>