@dcloudio/uni-app-x 0.7.37 → 0.7.39

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.
Files changed (126) hide show
  1. package/package.json +1 -1
  2. package/types/UniPage.d.ts +48 -9
  3. package/types/app.d.ts +8 -5
  4. package/types/native/AsyncApiResult.d.ts +1 -0
  5. package/types/native/CanvasRenderingContext2D.d.ts +1 -1
  6. package/types/native/IUniElement.d.ts +130 -35
  7. package/types/native/UniElement.d.ts +2 -1
  8. package/types/native/UniTextElement.d.ts +1 -0
  9. package/types/native/global.d.ts +16 -0
  10. package/types/page.d.ts +47 -5
  11. package/types/uni/env/index.d.ts +87 -73
  12. package/types/uni/global.d.ts +1 -0
  13. package/types/uni/index.d.ts +1 -0
  14. package/types/uni/uni-map-tencent-global.d.ts +33 -0
  15. package/types/uni/uni-map-tencent-map.d.ts +52 -0
  16. package/types/uni/uts-plugin-api/global.d.ts +2 -1
  17. package/types/uni/uts-plugin-api/index.d.ts +2 -1
  18. package/types/uni/uts-plugin-api/lib/uni-addPhoneContact/utssdk/global.d.ts +0 -2
  19. package/types/uni/uts-plugin-api/lib/uni-addPhoneContact/utssdk/index.d.ts +0 -1
  20. package/types/uni/uts-plugin-api/lib/uni-addPhoneContact/utssdk/interface.d.ts +212 -219
  21. package/types/uni/uts-plugin-api/lib/uni-arrayBufferToBase64/utssdk/interface.d.ts +73 -73
  22. package/types/uni/uts-plugin-api/lib/uni-authentication/utssdk/interface.d.ts +331 -205
  23. package/types/uni/uts-plugin-api/lib/uni-base64ToArrayBuffer/utssdk/interface.d.ts +73 -73
  24. package/types/uni/uts-plugin-api/lib/uni-canvas/utssdk/interface.d.ts +848 -208
  25. package/types/uni/{uts-plugin-extend → uts-plugin-api}/lib/uni-chooseLocation/utssdk/global.d.ts +5 -6
  26. package/types/uni/{uts-plugin-extend → uts-plugin-api}/lib/uni-chooseLocation/utssdk/index.d.ts +3 -3
  27. package/types/uni/uts-plugin-api/lib/uni-chooseLocation/utssdk/interface.d.ts +414 -0
  28. package/types/uni/uts-plugin-api/lib/uni-clipboard/utssdk/interface.d.ts +2 -2
  29. package/types/uni/uts-plugin-api/lib/uni-createInnerAudioContext/utssdk/global.d.ts +4 -0
  30. package/types/uni/uts-plugin-api/lib/uni-createInnerAudioContext/utssdk/index.d.ts +2 -0
  31. package/types/uni/uts-plugin-api/lib/uni-createInnerAudioContext/utssdk/interface.d.ts +1226 -1726
  32. package/types/uni/uts-plugin-api/lib/uni-createIntersectionObserver/utssdk/interface.d.ts +1 -1
  33. package/types/uni/uts-plugin-api/lib/uni-createSelectorQuery/utssdk/interface.d.ts +102 -18
  34. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/interface.d.ts +2 -2
  35. package/types/uni/uts-plugin-api/lib/uni-dialogPage/utssdk/interface.d.ts +1199 -1045
  36. package/types/uni/uts-plugin-api/lib/uni-event/utssdk/interface.d.ts +294 -263
  37. package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/interface.d.ts +33 -28
  38. package/types/uni/uts-plugin-api/lib/uni-file/utssdk/interface.d.ts +210 -0
  39. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/interface.d.ts +4828 -1750
  40. package/types/uni/uts-plugin-api/lib/uni-getAppAuthorizeSetting/utssdk/interface.d.ts +490 -448
  41. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/interface.d.ts +2138 -829
  42. package/types/uni/uts-plugin-api/lib/uni-getBackgroundAudioManager/utssdk/global.d.ts +4 -0
  43. package/types/uni/uts-plugin-api/lib/uni-getBackgroundAudioManager/utssdk/index.d.ts +2 -0
  44. package/types/uni/uts-plugin-api/lib/uni-getBackgroundAudioManager/utssdk/interface.d.ts +664 -114
  45. package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/interface.d.ts +891 -9
  46. package/types/uni/uts-plugin-api/lib/uni-getElementById/utssdk/interface.d.ts +3 -3
  47. package/types/uni/uts-plugin-api/lib/uni-getEnterOptionsSync/utssdk/interface.d.ts +254 -114
  48. package/types/uni/uts-plugin-api/lib/uni-getLaunchOptionsSync/utssdk/interface.d.ts +152 -12
  49. package/types/uni/uts-plugin-api/lib/uni-getLocation/utssdk/interface.d.ts +813 -57
  50. package/types/uni/uts-plugin-api/lib/uni-getLocation-tencent-uni1/utssdk/global.d.ts +0 -2
  51. package/types/uni/uts-plugin-api/lib/uni-getLocation-tencent-uni1/utssdk/interface.d.ts +0 -45
  52. package/types/uni/uts-plugin-api/lib/uni-getNetworkType/utssdk/interface.d.ts +274 -148
  53. package/types/uni/uts-plugin-api/lib/uni-getPerformance/utssdk/interface.d.ts +38 -3
  54. package/types/uni/uts-plugin-api/lib/uni-getRecorderManager/utssdk/interface.d.ts +969 -969
  55. package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/interface.d.ts +3161 -43
  56. package/types/uni/uts-plugin-api/lib/uni-getSystemSetting/utssdk/interface.d.ts +316 -22
  57. package/types/uni/uts-plugin-api/lib/uni-interceptor/utssdk/interface.d.ts +2 -2
  58. package/types/uni/uts-plugin-api/lib/uni-keyboard/utssdk/interface.d.ts +42 -0
  59. package/types/uni/uts-plugin-api/lib/uni-loadFontFace/utssdk/interface.d.ts +41 -41
  60. package/types/uni/uts-plugin-api/lib/uni-makePhoneCall/utssdk/interface.d.ts +88 -88
  61. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/global.d.ts +8 -0
  62. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/index.d.ts +4 -0
  63. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/interface.d.ts +2765 -1193
  64. package/types/uni/uts-plugin-api/lib/uni-navigationBar/utssdk/interface.d.ts +18 -18
  65. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/interface.d.ts +3098 -1153
  66. package/types/uni/uts-plugin-api/lib/uni-oauth/utssdk/interface.d.ts +13 -13
  67. package/types/uni/uts-plugin-api/lib/uni-openDocument/utssdk/interface.d.ts +42 -0
  68. package/types/uni/uts-plugin-api/lib/uni-pageScrollTo/utssdk/interface.d.ts +10 -10
  69. package/types/uni/uts-plugin-api/lib/uni-payment/utssdk/interface.d.ts +621 -369
  70. package/types/uni/uts-plugin-api/lib/uni-payment-huawei/utssdk/global.d.ts +8 -0
  71. package/types/uni/uts-plugin-api/lib/uni-payment-huawei/utssdk/index.d.ts +4 -0
  72. package/types/uni/uts-plugin-api/lib/uni-payment-huawei/utssdk/interface.d.ts +1 -0
  73. package/types/uni/uts-plugin-api/lib/uni-privacy/utssdk/interface.d.ts +540 -253
  74. package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/interface.d.ts +2602 -1131
  75. package/types/uni/uts-plugin-api/lib/uni-pullDownRefresh/utssdk/interface.d.ts +2 -2
  76. package/types/uni/uts-plugin-api/lib/uni-route/utssdk/interface.d.ts +58 -58
  77. package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/interface.d.ts +77 -35
  78. package/types/uni/uts-plugin-api/lib/uni-scanCode/utssdk/interface.d.ts +42 -0
  79. package/types/uni/uts-plugin-api/lib/uni-shareWithSystem/utssdk/global.d.ts +4 -0
  80. package/types/uni/uts-plugin-api/lib/uni-shareWithSystem/utssdk/index.d.ts +2 -0
  81. package/types/uni/uts-plugin-api/lib/uni-shareWithSystem/utssdk/interface.d.ts +614 -15
  82. package/types/uni/uts-plugin-api/lib/uni-storage/utssdk/interface.d.ts +857 -437
  83. package/types/uni/uts-plugin-api/lib/uni-tabBar/utssdk/interface.d.ts +58 -16
  84. package/types/uni/uts-plugin-api/lib/uni-theme/utssdk/global.d.ts +8 -0
  85. package/types/uni/uts-plugin-api/lib/uni-theme/utssdk/index.d.ts +4 -0
  86. package/types/uni/uts-plugin-api/lib/uni-theme/utssdk/interface.d.ts +1057 -516
  87. package/types/uni/uts-plugin-api/lib/uni-virtualPayment/utssdk/interface.d.ts +1656 -1488
  88. package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/interface.d.ts +1752 -786
  89. package/types/uni/uts-plugin-biz/global.d.ts +1 -0
  90. package/types/uni/uts-plugin-biz/index.d.ts +1 -0
  91. package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/interface.d.ts +85 -1
  92. package/types/uni/{uts-plugin-api → uts-plugin-biz}/lib/uni-crash/utssdk/interface.d.ts +46 -46
  93. package/types/uni/uts-plugin-biz/lib/uni-map-tencent/utssdk/interface.d.ts +72 -20
  94. package/types/uni/uts-plugin-biz/lib/uni-push/utssdk/interface.d.ts +126 -0
  95. package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/global.d.ts +4 -0
  96. package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/index.d.ts +2 -0
  97. package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/interface.d.ts +98 -15
  98. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/interface.d.ts +677 -299
  99. package/types/uni/uts-plugin-extend/README.md +3 -0
  100. package/types/uni/uts-plugin-extend/global.d.ts +1 -0
  101. package/types/uni/uts-plugin-extend/lib/uni-__f__/utssdk/global.d.ts +7 -0
  102. package/types/uni/uts-plugin-extend/lib/uni-__f__/utssdk/index.d.ts +0 -0
  103. package/types/uni/uts-plugin-extend/lib/uni-__f__/utssdk/interface.d.ts +3 -0
  104. package/types/uni/uts-plugin-extend/lib/uni-accelerometer/utssdk/interface.d.ts +4 -4
  105. package/types/uni/uts-plugin-extend/lib/uni-canvas/utssdk/interface.d.ts +5 -5
  106. package/types/uni/uts-plugin-extend/lib/uni-compass/utssdk/interface.d.ts +302 -302
  107. package/types/uni/uts-plugin-extend/lib/uni-createMediaQueryObserver/utssdk/interface.d.ts +77 -77
  108. package/types/uni/uts-plugin-extend/lib/uni-getBackgroundAudioManager/utssdk/interface.d.ts +431 -11
  109. package/types/uni/uts-plugin-extend/lib/uni-locale/utssdk/interface.d.ts +3 -3
  110. package/types/uni/uts-plugin-extend/lib/uni-localeChange/utssdk/interface.d.ts +6 -6
  111. package/types/uni/uts-plugin-extend/lib/uni-memory/utssdk/interface.d.ts +2 -2
  112. package/types/uni/uts-plugin-extend/lib/uni-openLocation/utssdk/interface.d.ts +73 -73
  113. package/types/uni-cloud/interface.d.ts +91 -0
  114. package/uts-plugin.d.ts +3 -1
  115. package/types/uni/uts-plugin-extend/lib/uni-chooseLocation/utssdk/interface.d.ts +0 -151
  116. package/types/uni/uts-plugin-extend/lib/uni-createInnerAudioContext/utssdk/global.d.ts +0 -11
  117. package/types/uni/uts-plugin-extend/lib/uni-createInnerAudioContext/utssdk/index.d.ts +0 -4
  118. package/types/uni/uts-plugin-extend/lib/uni-createInnerAudioContext/utssdk/interface.d.ts +0 -224
  119. package/types/uni/uts-plugin-extend/lib/uni-createMapContext/utssdk/global.d.ts +0 -53
  120. package/types/uni/uts-plugin-extend/lib/uni-createMapContext/utssdk/index.d.ts +0 -25
  121. package/types/uni/uts-plugin-extend/lib/uni-createMapContext/utssdk/interface.d.ts +0 -487
  122. package/types/uni/uts-plugin-extend/lib/uni-theme/utssdk/global.d.ts +0 -9
  123. package/types/uni/uts-plugin-extend/lib/uni-theme/utssdk/index.d.ts +0 -1
  124. package/types/uni/uts-plugin-extend/lib/uni-theme/utssdk/interface.d.ts +0 -165
  125. /package/types/uni/{uts-plugin-api → uts-plugin-biz}/lib/uni-crash/utssdk/global.d.ts +0 -0
  126. /package/types/uni/{uts-plugin-api → uts-plugin-biz}/lib/uni-crash/utssdk/index.d.ts +0 -0
@@ -1,272 +1,566 @@
1
1
  export interface Uni {
2
- /**
3
- * 创建一个 WebSocket 连接。
4
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#connectsocket
5
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#connectsocket
6
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#connectsocket
7
- * @uniPlatform
8
- * {
9
- * "app": {
10
- * "android": {
11
- * "osVer": "4.4",
12
- * "uniVer": "√",
13
- * "unixVer": "3.9+"
14
- * },
15
- * "ios": {
16
- * "osVer": "12.0",
17
- * "uniVer": "√",
18
- * "unixVer": "4.11"
19
- * },
20
- * "harmony": {
21
- * "osVer": "3.0",
22
- * "uniVer": "4.23",
23
- * "unixVer": "x"
24
- * }
25
- * },
26
- * "web": {
27
- * "uniVer": "√",
28
- * "unixVer": "4.0"
29
- * }
30
- * }
31
- * @example
32
- ```typescript
33
- uni.connectSocket({
34
- url: "ws://192.168.12.106:8080/ws",
35
- complete: (e) => {
36
- console.log("socket :", e);
37
- }
38
- });
39
- ```
40
- */
41
- connectSocket(options: ConnectSocketOptions): SocketTask;
42
- /**
43
- * @description
44
- * 监听WebSocket连接打开事件。
45
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketopen
46
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketopen
47
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketopen
48
- * @uniPlatform
49
- * {
50
- * "app": {
51
- * "android": {
52
- * "osVer": "4.4",
53
- * "uniVer": "√",
54
- * "unixVer": "3.9+"
55
- * },
56
- * "ios": {
57
- * "osVer": "12.0",
58
- * "uniVer": "√",
59
- * "unixVer": "4.11"
60
- * },
61
- * "harmony": {
62
- * "osVer": "3.0",
63
- * "uniVer": "4.23",
64
- * "unixVer": "x"
65
- * }
66
- * },
67
- * "web": {
68
- * "uniVer": "√",
69
- * "unixVer": "4.0"
70
- * }
71
- * }
72
- * @example
73
- ```typescript
74
- uni.onSocketOpen(function (res) {
75
- console.log('WebSocket连接已打开!');
76
- });
77
- ```
78
- */
79
- onSocketOpen(options: OnSocketOpenCallback): void;
2
+ /**
3
+ * 创建一个 WebSocket 连接。
4
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#connectsocket
5
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#connectsocket
6
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#connectsocket
7
+ * @uniPlatform
8
+ * {
9
+ * "app": {
10
+ * "android": {
11
+ * "osVer": "4.4",
12
+ * "uniVer": "√",
13
+ * "unixVer": "3.9+"
14
+ * },
15
+ * "ios": {
16
+ * "osVer": "12.0",
17
+ * "uniVer": "√",
18
+ * "unixVer": "4.11"
19
+ * },
20
+ * "harmony": {
21
+ * "osVer": "3.0",
22
+ * "uniVer": "4.23",
23
+ * "unixVer": "x"
24
+ * }
25
+ * },
26
+ * "mp": {
27
+ * "weixin": {
28
+ * "hostVer": "",
29
+ * "uniVer": "√",
30
+ * "unixVer": "4.41"
31
+ * },
32
+ * "alipay": {
33
+ * "hostVer": "√",
34
+ * "uniVer": "",
35
+ * "unixVer": "x"
36
+ * },
37
+ * "baidu": {
38
+ * "hostVer": "√",
39
+ * "uniVer": "√",
40
+ * "unixVer": "x"
41
+ * },
42
+ * "toutiao": {
43
+ * "hostVer": "√",
44
+ * "uniVer": "√",
45
+ * "unixVer": "x"
46
+ * },
47
+ * "lark": {
48
+ * "hostVer": "√",
49
+ * "uniVer": "√",
50
+ * "unixVer": "x"
51
+ * },
52
+ * "qq": {
53
+ * "hostVer": "√",
54
+ * "uniVer": "",
55
+ * "unixVer": "x"
56
+ * },
57
+ * "kuaishou": {
58
+ * "hostVer": "√",
59
+ * "uniVer": "",
60
+ * "unixVer": "x"
61
+ * },
62
+ * "jd": {
63
+ * "hostVer": "",
64
+ * "uniVer": "",
65
+ * "unixVer": "x"
66
+ * }
67
+ * },
68
+ * "web": {
69
+ * "uniVer": "",
70
+ * "unixVer": "4.0"
71
+ * }
72
+ * }
73
+ * @example
74
+ ```typescript
75
+ uni.connectSocket({
76
+ url: "ws://192.168.12.106:8080/ws",
77
+ complete: (e) => {
78
+ console.log("socket :", e);
79
+ }
80
+ });
81
+ ```
82
+ */
83
+ connectSocket(options: ConnectSocketOptions): SocketTask;
84
+ /**
85
+ * @description
86
+ * 监听WebSocket连接打开事件。
87
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketopen
88
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketopen
89
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketopen
90
+ * @uniPlatform
91
+ * {
92
+ * "app": {
93
+ * "android": {
94
+ * "osVer": "4.4",
95
+ * "uniVer": "√",
96
+ * "unixVer": "3.9+"
97
+ * },
98
+ * "ios": {
99
+ * "osVer": "12.0",
100
+ * "uniVer": "√",
101
+ * "unixVer": "4.11"
102
+ * },
103
+ * "harmony": {
104
+ * "osVer": "3.0",
105
+ * "uniVer": "4.23",
106
+ * "unixVer": "x"
107
+ * }
108
+ * },
109
+ * "mp": {
110
+ * "weixin": {
111
+ * "hostVer": "√",
112
+ * "uniVer": "√",
113
+ * "unixVer": "4.41"
114
+ * },
115
+ * "alipay": {
116
+ * "hostVer": "√",
117
+ * "uniVer": "√",
118
+ * "unixVer": "x"
119
+ * },
120
+ * "baidu": {
121
+ * "hostVer": "√",
122
+ * "uniVer": "√",
123
+ * "unixVer": "x"
124
+ * },
125
+ * "toutiao": {
126
+ * "hostVer": "√",
127
+ * "uniVer": "√",
128
+ * "unixVer": "x"
129
+ * },
130
+ * "lark": {
131
+ * "hostVer": "√",
132
+ * "uniVer": "√",
133
+ * "unixVer": "x"
134
+ * },
135
+ * "qq": {
136
+ * "hostVer": "√",
137
+ * "uniVer": "√",
138
+ * "unixVer": "x"
139
+ * },
140
+ * "kuaishou": {
141
+ * "hostVer": "√",
142
+ * "uniVer": "√",
143
+ * "unixVer": "x"
144
+ * },
145
+ * "jd": {
146
+ * "hostVer": "√",
147
+ * "uniVer": "√",
148
+ * "unixVer": "x"
149
+ * }
150
+ * },
151
+ * "web": {
152
+ * "uniVer": "√",
153
+ * "unixVer": "4.0"
154
+ * }
155
+ * }
156
+ * @example
157
+ ```typescript
158
+ uni.onSocketOpen(function (res) {
159
+ console.log('WebSocket连接已打开!');
160
+ });
161
+ ```
162
+ */
163
+ onSocketOpen(options: OnSocketOpenCallback): void;
80
164
 
81
- /**
82
- * 监听WebSocket错误。
83
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketerror
84
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketerror
85
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketerror
86
- * @uniPlatform
87
- * {
88
- * "app": {
89
- * "android": {
90
- * "osVer": "4.4",
91
- * "uniVer": "√",
92
- * "unixVer": "3.9+"
93
- * },
94
- * "ios": {
95
- * "osVer": "12.0",
96
- * "uniVer": "√",
97
- * "unixVer": "4.11"
98
- * },
99
- * "harmony": {
100
- * "osVer": "3.0",
101
- * "uniVer": "4.23",
102
- * "unixVer": "x"
103
- * }
104
- * },
105
- * "web": {
106
- * "uniVer": "√",
107
- * "unixVer": "4.0"
108
- * }
109
- * }
110
- * @example
111
- ```typescript
112
- uni.onSocketError(function (res) {
113
- console.log('WebSocket连接打开失败,请检查!');
114
- });
115
- ```
116
- */
117
- onSocketError(callback: OnSocketErrorCallback): void;
165
+ /**
166
+ * 监听WebSocket错误。
167
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketerror
168
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketerror
169
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketerror
170
+ * @uniPlatform
171
+ * {
172
+ * "app": {
173
+ * "android": {
174
+ * "osVer": "4.4",
175
+ * "uniVer": "√",
176
+ * "unixVer": "3.9+"
177
+ * },
178
+ * "ios": {
179
+ * "osVer": "12.0",
180
+ * "uniVer": "√",
181
+ * "unixVer": "4.11"
182
+ * },
183
+ * "harmony": {
184
+ * "osVer": "3.0",
185
+ * "uniVer": "4.23",
186
+ * "unixVer": "x"
187
+ * }
188
+ * },
189
+ * "mp": {
190
+ * "weixin": {
191
+ * "hostVer": "",
192
+ * "uniVer": "√",
193
+ * "unixVer": "4.41"
194
+ * },
195
+ * "alipay": {
196
+ * "hostVer": "√",
197
+ * "uniVer": "√",
198
+ * "unixVer": "x"
199
+ * },
200
+ * "baidu": {
201
+ * "hostVer": "√",
202
+ * "uniVer": "√",
203
+ * "unixVer": "x"
204
+ * },
205
+ * "toutiao": {
206
+ * "hostVer": "√",
207
+ * "uniVer": "√",
208
+ * "unixVer": "x"
209
+ * },
210
+ * "lark": {
211
+ * "hostVer": "√",
212
+ * "uniVer": "√",
213
+ * "unixVer": "x"
214
+ * },
215
+ * "qq": {
216
+ * "hostVer": "√",
217
+ * "uniVer": "√",
218
+ * "unixVer": "x"
219
+ * },
220
+ * "kuaishou": {
221
+ * "hostVer": "√",
222
+ * "uniVer": "√",
223
+ * "unixVer": "x"
224
+ * },
225
+ * "jd": {
226
+ * "hostVer": "√",
227
+ * "uniVer": "√",
228
+ * "unixVer": "x"
229
+ * }
230
+ * },
231
+ * "web": {
232
+ * "uniVer": "√",
233
+ * "unixVer": "4.0"
234
+ * }
235
+ * }
236
+ * @example
237
+ ```typescript
238
+ uni.onSocketError(function (res) {
239
+ console.log('WebSocket连接打开失败,请检查!');
240
+ });
241
+ ```
242
+ */
243
+ onSocketError(callback: OnSocketErrorCallback): void;
118
244
 
119
- /**
120
- * 通过 WebSocket 连接发送数据,需要先 uni.connectSocket,并在 uni.onSocketOpen 回调之后才能发送。
121
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#sendsocketmessage
122
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#sendsocketmessage
123
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#sendsocketmessage
124
- * @uniPlatform
125
- * {
126
- * "app": {
127
- * "android": {
128
- * "osVer": "4.4",
129
- * "uniVer": "√",
130
- * "unixVer": "3.9+"
131
- * },
132
- * "ios": {
133
- * "osVer": "12.0",
134
- * "uniVer": "√",
135
- * "unixVer": "4.11"
136
- * },
137
- * "harmony": {
138
- * "osVer": "x",
139
- * "uniVer": "x",
140
- * "unixVer": "x"
141
- * }
142
- * },
143
- * "web": {
144
- * "uniVer": "√",
145
- * "unixVer": "4.0"
146
- * }
147
- * }
148
- * @example
149
- ```typescript
150
- uni.sendSocketMessage({
151
- data: msg
152
- });
153
- ```
154
- */
155
- sendSocketMessage(options: SendSocketMessageOptions): void;
156
- /**
157
- * 监听WebSocket接受到服务器的消息事件。
158
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketmessage
159
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketmessage
160
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketmessage
161
- * @uniPlatform
162
- * {
163
- * "app": {
164
- * "android": {
165
- * "osVer": "4.4",
166
- * "uniVer": "√",
167
- * "unixVer": "3.9+"
168
- * },
169
- * "ios": {
170
- * "osVer": "12.0",
171
- * "uniVer": "√",
172
- * "unixVer": "4.11"
173
- * },
174
- * "harmony": {
175
- * "osVer": "3.0",
176
- * "uniVer": "4.23",
177
- * "unixVer": "x"
178
- * }
179
- * },
180
- * "web": {
181
- * "uniVer": "√",
182
- * "unixVer": "4.0"
183
- * }
184
- * }
185
- * @example
186
- ```typescript
187
- uni.onSocketMessage(function (res) {
188
- console.log('收到服务器内容:' + res.data);
189
- });
190
- ```
191
- */
192
- onSocketMessage(callback: OnSocketMessageCallback): void;
193
- /**
194
- * 关闭 WebSocket 连接。
195
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#closesocket
196
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#closesocket
197
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#closesocket
198
- * @uniPlatform
199
- * {
200
- * "app": {
201
- * "android": {
202
- * "osVer": "4.4",
203
- * "uniVer": "√",
204
- * "unixVer": "3.9+"
205
- * },
206
- * "ios": {
207
- * "osVer": "12.0",
208
- * "uniVer": "√",
209
- * "unixVer": "4.11"
210
- * },
211
- * "harmony": {
212
- * "osVer": "3.0",
213
- * "uniVer": "4.23",
214
- * "unixVer": "x"
215
- * }
216
- * },
217
- * "web": {
218
- * "uniVer": "",
219
- * "unixVer": "4.0"
220
- * }
221
- * }
222
- * @example
223
- ```typescript
224
- uni.closeSocket();
225
- ```
226
- */
227
- closeSocket(options: CloseSocketOptions): void;
228
- /**
229
- * 监听WebSocket关闭。
230
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketclose
231
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketclose
232
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketclose
233
- * @uniPlatform
234
- * {
235
- * "app": {
236
- * "android": {
237
- * "osVer": "4.4",
238
- * "uniVer": "√",
239
- * "unixVer": "3.9+"
240
- * },
241
- * "ios": {
242
- * "osVer": "12.0",
243
- * "uniVer": "√",
244
- * "unixVer": "4.11"
245
- * },
246
- * "harmony": {
247
- * "osVer": "3.0",
248
- * "uniVer": "4.23",
249
- * "unixVer": "x"
250
- * }
251
- * },
252
- * "web": {
253
- * "uniVer": "√",
254
- * "unixVer": "4.0"
255
- * }
256
- * }
257
- * @example
258
- ```typescript
259
- uni.onSocketClose(function (res) {
260
- console.log('WebSocket 已关闭!');
261
- });
262
- ```
263
- */
264
- onSocketClose(callback: OnSocketCloseCallback): void;
245
+ /**
246
+ * 通过 WebSocket 连接发送数据,需要先 uni.connectSocket,并在 uni.onSocketOpen 回调之后才能发送。
247
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#sendsocketmessage
248
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#sendsocketmessage
249
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#sendsocketmessage
250
+ * @uniPlatform
251
+ * {
252
+ * "app": {
253
+ * "android": {
254
+ * "osVer": "4.4",
255
+ * "uniVer": "√",
256
+ * "unixVer": "3.9+"
257
+ * },
258
+ * "ios": {
259
+ * "osVer": "12.0",
260
+ * "uniVer": "√",
261
+ * "unixVer": "4.11"
262
+ * },
263
+ * "harmony": {
264
+ * "osVer": "3,0",
265
+ * "uniVer": "4.23",
266
+ * "unixVer": "x"
267
+ * }
268
+ * },
269
+ * "mp": {
270
+ * "weixin": {
271
+ * "hostVer": "",
272
+ * "uniVer": "√",
273
+ * "unixVer": "4.41"
274
+ * },
275
+ * "alipay": {
276
+ * "hostVer": "√",
277
+ * "uniVer": "√",
278
+ * "unixVer": "x"
279
+ * },
280
+ * "baidu": {
281
+ * "hostVer": "√",
282
+ * "uniVer": "√",
283
+ * "unixVer": "x"
284
+ * },
285
+ * "toutiao": {
286
+ * "hostVer": "√",
287
+ * "uniVer": "√",
288
+ * "unixVer": "x"
289
+ * },
290
+ * "lark": {
291
+ * "hostVer": "",
292
+ * "uniVer": "√",
293
+ * "unixVer": "x"
294
+ * },
295
+ * "qq": {
296
+ * "hostVer": "",
297
+ * "uniVer": "√",
298
+ * "unixVer": "x"
299
+ * },
300
+ * "kuaishou": {
301
+ * "hostVer": "",
302
+ * "uniVer": "",
303
+ * "unixVer": "x"
304
+ * },
305
+ * "jd": {
306
+ * "hostVer": "√",
307
+ * "uniVer": "√",
308
+ * "unixVer": "x"
309
+ * }
310
+ * },
311
+ * "web": {
312
+ * "uniVer": "√",
313
+ * "unixVer": "4.0"
314
+ * }
315
+ * }
316
+ * @example
317
+ ```typescript
318
+ uni.sendSocketMessage({
319
+ data: msg
320
+ });
321
+ ```
322
+ */
323
+ sendSocketMessage(options: SendSocketMessageOptions): void;
324
+ /**
325
+ * 监听WebSocket接受到服务器的消息事件。
326
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketmessage
327
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketmessage
328
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketmessage
329
+ * @uniPlatform
330
+ * {
331
+ * "app": {
332
+ * "android": {
333
+ * "osVer": "4.4",
334
+ * "uniVer": "√",
335
+ * "unixVer": "3.9+"
336
+ * },
337
+ * "ios": {
338
+ * "osVer": "12.0",
339
+ * "uniVer": "",
340
+ * "unixVer": "4.11"
341
+ * },
342
+ * "harmony": {
343
+ * "osVer": "3.0",
344
+ * "uniVer": "4.23",
345
+ * "unixVer": "x"
346
+ * }
347
+ * },
348
+ * "mp": {
349
+ * "weixin": {
350
+ * "hostVer": "√",
351
+ * "uniVer": "√",
352
+ * "unixVer": "4.41"
353
+ * },
354
+ * "alipay": {
355
+ * "hostVer": "√",
356
+ * "uniVer": "√",
357
+ * "unixVer": "x"
358
+ * },
359
+ * "baidu": {
360
+ * "hostVer": "√",
361
+ * "uniVer": "√",
362
+ * "unixVer": "x"
363
+ * },
364
+ * "toutiao": {
365
+ * "hostVer": "",
366
+ * "uniVer": "√",
367
+ * "unixVer": "x"
368
+ * },
369
+ * "lark": {
370
+ * "hostVer": "",
371
+ * "uniVer": "√",
372
+ * "unixVer": "x"
373
+ * },
374
+ * "qq": {
375
+ * "hostVer": "",
376
+ * "uniVer": "√",
377
+ * "unixVer": "x"
378
+ * },
379
+ * "kuaishou": {
380
+ * "hostVer": "",
381
+ * "uniVer": "√",
382
+ * "unixVer": "x"
383
+ * },
384
+ * "jd": {
385
+ * "hostVer": "√",
386
+ * "uniVer": "√",
387
+ * "unixVer": "x"
388
+ * }
389
+ * },
390
+ * "web": {
391
+ * "uniVer": "√",
392
+ * "unixVer": "4.0"
393
+ * }
394
+ * }
395
+ * @example
396
+ ```typescript
397
+ uni.onSocketMessage(function (res) {
398
+ console.log('收到服务器内容:' + res.data);
399
+ });
400
+ ```
401
+ */
402
+ onSocketMessage(callback: OnSocketMessageCallback): void;
403
+ /**
404
+ * 关闭 WebSocket 连接。
405
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#closesocket
406
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#closesocket
407
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#closesocket
408
+ * @uniPlatform
409
+ * {
410
+ * "app": {
411
+ * "android": {
412
+ * "osVer": "4.4",
413
+ * "uniVer": "√",
414
+ * "unixVer": "3.9+"
415
+ * },
416
+ * "ios": {
417
+ * "osVer": "12.0",
418
+ * "uniVer": "√",
419
+ * "unixVer": "4.11"
420
+ * },
421
+ * "harmony": {
422
+ * "osVer": "3.0",
423
+ * "uniVer": "4.23",
424
+ * "unixVer": "x"
425
+ * }
426
+ * },
427
+ * "mp": {
428
+ * "weixin": {
429
+ * "hostVer": "√",
430
+ * "uniVer": "√",
431
+ * "unixVer": "4.41"
432
+ * },
433
+ * "alipay": {
434
+ * "hostVer": "√",
435
+ * "uniVer": "√",
436
+ * "unixVer": "x"
437
+ * },
438
+ * "baidu": {
439
+ * "hostVer": "√",
440
+ * "uniVer": "√",
441
+ * "unixVer": "x"
442
+ * },
443
+ * "toutiao": {
444
+ * "hostVer": "√",
445
+ * "uniVer": "√",
446
+ * "unixVer": "x"
447
+ * },
448
+ * "lark": {
449
+ * "hostVer": "√",
450
+ * "uniVer": "√",
451
+ * "unixVer": "x"
452
+ * },
453
+ * "qq": {
454
+ * "hostVer": "√",
455
+ * "uniVer": "√",
456
+ * "unixVer": "x"
457
+ * },
458
+ * "kuaishou": {
459
+ * "hostVer": "√",
460
+ * "uniVer": "√",
461
+ * "unixVer": "x"
462
+ * },
463
+ * "jd": {
464
+ * "hostVer": "√",
465
+ * "uniVer": "√",
466
+ * "unixVer": "x"
467
+ * }
468
+ * },
469
+ * "web": {
470
+ * "uniVer": "√",
471
+ * "unixVer": "4.0"
472
+ * }
473
+ * }
474
+ * @example
475
+ ```typescript
476
+ uni.closeSocket();
477
+ ```
478
+ */
479
+ closeSocket(options: CloseSocketOptions): void;
480
+ /**
481
+ * 监听WebSocket关闭。
482
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketclose
483
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketclose
484
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketclose
485
+ * @uniPlatform
486
+ * {
487
+ * "app": {
488
+ * "android": {
489
+ * "osVer": "4.4",
490
+ * "uniVer": "√",
491
+ * "unixVer": "3.9+"
492
+ * },
493
+ * "ios": {
494
+ * "osVer": "12.0",
495
+ * "uniVer": "√",
496
+ * "unixVer": "4.11"
497
+ * },
498
+ * "harmony": {
499
+ * "osVer": "3.0",
500
+ * "uniVer": "4.23",
501
+ * "unixVer": "x"
502
+ * }
503
+ * },
504
+ * "mp": {
505
+ * "weixin": {
506
+ * "hostVer": "√",
507
+ * "uniVer": "√",
508
+ * "unixVer": "4.41"
509
+ * },
510
+ * "alipay": {
511
+ * "hostVer": "√",
512
+ * "uniVer": "√",
513
+ * "unixVer": "x"
514
+ * },
515
+ * "baidu": {
516
+ * "hostVer": "√",
517
+ * "uniVer": "√",
518
+ * "unixVer": "x"
519
+ * },
520
+ * "toutiao": {
521
+ * "hostVer": "√",
522
+ * "uniVer": "√",
523
+ * "unixVer": "x"
524
+ * },
525
+ * "lark": {
526
+ * "hostVer": "√",
527
+ * "uniVer": "√",
528
+ * "unixVer": "x"
529
+ * },
530
+ * "qq": {
531
+ * "hostVer": "√",
532
+ * "uniVer": "√",
533
+ * "unixVer": "x"
534
+ * },
535
+ * "kuaishou": {
536
+ * "hostVer": "√",
537
+ * "uniVer": "√",
538
+ * "unixVer": "x"
539
+ * },
540
+ * "jd": {
541
+ * "hostVer": "√",
542
+ * "uniVer": "√",
543
+ * "unixVer": "x"
544
+ * }
545
+ * },
546
+ * "web": {
547
+ * "uniVer": "√",
548
+ * "unixVer": "4.0"
549
+ * }
550
+ * }
551
+ * @example
552
+ ```typescript
553
+ uni.onSocketClose(function (res) {
554
+ console.log('WebSocket 已关闭!');
555
+ });
556
+ ```
557
+ */
558
+ onSocketClose(callback: OnSocketCloseCallback): void;
265
559
  }
266
560
 
267
561
  export type ConnectSocket = (options: ConnectSocketOptions) => SocketTask;
268
562
  export type ConnectSocketSuccess = {
269
- errMsg: string
563
+ errMsg: string
270
564
  };
271
565
  type ConnectSocketSuccessCallback = (result: ConnectSocketSuccess) => void;
272
566
  /**
@@ -279,515 +573,1103 @@ export type ConnectSocketErrorCode = 600009;
279
573
  * 连接调用失败的错误回调参数
280
574
  */
281
575
  export interface ConnectSocketFail extends IUniError {
282
- errCode: ConnectSocketErrorCode;
576
+ errCode: ConnectSocketErrorCode;
283
577
  };
284
578
 
285
579
  type ConnectSocketFailCallback = (result: ConnectSocketFail) => void;
286
580
  type ConnectSocketComplete = any;
287
581
  type ConnectSocketCompleteCallback = (result: ConnectSocketComplete) => void;
288
582
  export type ConnectSocketOptions = {
289
- /**
290
- * 开发者服务器接口地址
291
- * @uniPlatform
292
- * {
293
- * "app": {
294
- * "android": {
295
- * "osVer": "5.0",
296
- * "uniVer": "√",
297
- * "unixVer": "3.9+"
298
- * },
299
- * "ios": {
300
- * "osVer": "12.0",
301
- * "uniVer": "√",
302
- * "unixVer": "4.11"
303
- * },
304
- * "harmony": {
305
- * "osVer": "3.0",
306
- * "uniVer": "4.23",
307
- * "unixVer": "x"
308
- * }
309
- * }
310
- * }
311
- */
312
- url: string,
313
- /**
314
- * HTTP 请求 Header,header 中不能设置 Referer
315
- * @defaultValue null
316
- * @uniPlatform
317
- * {
318
- * "app": {
319
- * "android": {
320
- * "osVer": "5.0",
321
- * "uniVer": "√",
322
- * "unixVer": "3.9+"
323
- * },
324
- * "ios": {
325
- * "osVer": "12.0",
326
- * "uniVer": "√",
327
- * "unixVer": "4.11"
328
- * },
329
- * "harmony": {
330
- * "osVer": "3.0",
331
- * "uniVer": "4.23",
332
- * "unixVer": "x"
333
- * }
334
- * }
335
- * }
336
- */
337
- header?: UTSJSONObject | null,
338
- /**
339
- * 子协议数组
340
- * @defaultValue null
341
- * @uniPlatform
342
- * {
343
- * "app": {
344
- * "android": {
345
- * "osVer": "5.0",
346
- * "uniVer": "√",
347
- * "unixVer": "3.9+"
348
- * },
349
- * "ios": {
350
- * "osVer": "12.0",
351
- * "uniVer": "√",
352
- * "unixVer": "4.11"
353
- * }
354
- * }
355
- * }
356
- */
357
- protocols?: (string[]) | null,
358
- /**
359
- * 接口调用成功的回调函数
360
- * @defaultValue null
361
- */
362
- success?: ConnectSocketSuccessCallback | null,
363
- /**
364
- * 接口调用失败的回调函数
365
- * @defaultValue null
366
- */
367
- fail?: ConnectSocketFailCallback | null,
368
- /**
369
- * 接口调用结束的回调函数(调用成功、失败都会执行)
370
- * @defaultValue null
371
- */
372
- complete?: ConnectSocketCompleteCallback | null
583
+ /**
584
+ * 开发者服务器接口地址
585
+ * @uniPlatform
586
+ * {
587
+ * "app": {
588
+ * "android": {
589
+ * "osVer": "5.0",
590
+ * "uniVer": "√",
591
+ * "unixVer": "3.9+"
592
+ * },
593
+ * "ios": {
594
+ * "osVer": "12.0",
595
+ * "uniVer": "√",
596
+ * "unixVer": "4.11"
597
+ * },
598
+ * "harmony": {
599
+ * "osVer": "3.0",
600
+ * "uniVer": "4.23",
601
+ * "unixVer": "x"
602
+ * }
603
+ * },
604
+ * "mp": {
605
+ * "weixin": {
606
+ * "hostVer": "√",
607
+ * "uniVer": "√",
608
+ * "unixVer": "4.41"
609
+ * },
610
+ * "alipay": {
611
+ * "hostVer": "√",
612
+ * "uniVer": "√",
613
+ * "unixVer": "x"
614
+ * },
615
+ * "baidu": {
616
+ * "hostVer": "",
617
+ * "uniVer": "√",
618
+ * "unixVer": "x"
619
+ * },
620
+ * "toutiao": {
621
+ * "hostVer": "",
622
+ * "uniVer": "√",
623
+ * "unixVer": "x"
624
+ * },
625
+ * "lark": {
626
+ * "hostVer": "",
627
+ * "uniVer": "√",
628
+ * "unixVer": "x"
629
+ * },
630
+ * "qq": {
631
+ * "hostVer": "√",
632
+ * "uniVer": "√",
633
+ * "unixVer": "x"
634
+ * },
635
+ * "kuaishou": {
636
+ * "hostVer": "√",
637
+ * "uniVer": "√",
638
+ * "unixVer": "x"
639
+ * },
640
+ * "jd": {
641
+ * "hostVer": "",
642
+ * "uniVer": "√",
643
+ * "unixVer": "x"
644
+ * }
645
+ * }
646
+ * }
647
+ */
648
+ url: string,
649
+ /**
650
+ * HTTP 请求 Header,header 中不能设置 Referer
651
+ * @defaultValue null
652
+ * @uniPlatform
653
+ * {
654
+ * "app": {
655
+ * "android": {
656
+ * "osVer": "5.0",
657
+ * "uniVer": "√",
658
+ * "unixVer": "3.9+"
659
+ * },
660
+ * "ios": {
661
+ * "osVer": "12.0",
662
+ * "uniVer": "√",
663
+ * "unixVer": "4.11"
664
+ * },
665
+ * "harmony": {
666
+ * "osVer": "3.0",
667
+ * "uniVer": "4.23",
668
+ * "unixVer": "x"
669
+ * }
670
+ * },
671
+ * "mp": {
672
+ * "weixin": {
673
+ * "hostVer": "√",
674
+ * "uniVer": "√",
675
+ * "unixVer": "4.41"
676
+ * },
677
+ * "alipay": {
678
+ * "hostVer": "√",
679
+ * "uniVer": "√",
680
+ * "unixVer": "x"
681
+ * },
682
+ * "baidu": {
683
+ * "hostVer": "√",
684
+ * "uniVer": "√",
685
+ * "unixVer": "x"
686
+ * },
687
+ * "toutiao": {
688
+ * "hostVer": "√",
689
+ * "uniVer": "√",
690
+ * "unixVer": "x"
691
+ * },
692
+ * "lark": {
693
+ * "hostVer": "√",
694
+ * "uniVer": "√",
695
+ * "unixVer": "x"
696
+ * },
697
+ * "qq": {
698
+ * "hostVer": "√",
699
+ * "uniVer": "√",
700
+ * "unixVer": "x"
701
+ * },
702
+ * "kuaishou": {
703
+ * "hostVer": "√",
704
+ * "uniVer": "√",
705
+ * "unixVer": "x"
706
+ * },
707
+ * "jd": {
708
+ * "hostVer": "√",
709
+ * "uniVer": "√",
710
+ * "unixVer": "x"
711
+ * }
712
+ * }
713
+ * }
714
+ */
715
+ header?: UTSJSONObject | null,
716
+ /**
717
+ * 子协议数组
718
+ * @defaultValue null
719
+ * @uniPlatform
720
+ * {
721
+ * "app": {
722
+ * "android": {
723
+ * "osVer": "5.0",
724
+ * "uniVer": "√",
725
+ * "unixVer": "3.9+"
726
+ * },
727
+ * "ios": {
728
+ * "osVer": "12.0",
729
+ * "uniVer": "√",
730
+ * "unixVer": "4.11"
731
+ * }
732
+ * },
733
+ * "mp": {
734
+ * "weixin": {
735
+ * "hostVer": "√",
736
+ * "uniVer": "√",
737
+ * "unixVer": "4.41"
738
+ * },
739
+ * "alipay": {
740
+ * "hostVer": "√",
741
+ * "uniVer": "√",
742
+ * "unixVer": "x"
743
+ * },
744
+ * "baidu": {
745
+ * "hostVer": "√",
746
+ * "uniVer": "√",
747
+ * "unixVer": "x"
748
+ * },
749
+ * "toutiao": {
750
+ * "hostVer": "√",
751
+ * "uniVer": "√",
752
+ * "unixVer": "x"
753
+ * },
754
+ * "lark": {
755
+ * "hostVer": "√",
756
+ * "uniVer": "√",
757
+ * "unixVer": "x"
758
+ * },
759
+ * "qq": {
760
+ * "hostVer": "√",
761
+ * "uniVer": "√",
762
+ * "unixVer": "x"
763
+ * },
764
+ * "kuaishou": {
765
+ * "hostVer": "√",
766
+ * "uniVer": "√",
767
+ * "unixVer": "x"
768
+ * },
769
+ * "jd": {
770
+ * "hostVer": "√",
771
+ * "uniVer": "√",
772
+ * "unixVer": "x"
773
+ * }
774
+ * }
775
+ * }
776
+ */
777
+ protocols?: (string[]) | null,
778
+ /**
779
+ * 接口调用成功的回调函数
780
+ * @defaultValue null
781
+ */
782
+ success?: ConnectSocketSuccessCallback | null,
783
+ /**
784
+ * 接口调用失败的回调函数
785
+ * @defaultValue null
786
+ */
787
+ fail?: ConnectSocketFailCallback | null,
788
+ /**
789
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
790
+ * @defaultValue null
791
+ */
792
+ complete?: ConnectSocketCompleteCallback | null
373
793
  };
374
794
  export type GeneralCallbackResult = {
375
- /**
376
- * 错误信息
377
- */
378
- errMsg: string
795
+ /**
796
+ * 错误信息
797
+ */
798
+ errMsg: string
379
799
  };
380
800
  /**
381
801
  * 错误码
382
802
  */
383
803
  export type SendSocketMessageErrorCode =
384
- /**
385
- * 发送数据超限,发送队列不能超过16M大小。
386
- */
387
- 10001 |
388
- /**
389
- * websocket未连接
390
- */
391
- 10002 |
392
- /**
393
- * websocket系统错误
394
- */
395
- 602001;
804
+ /**
805
+ * 发送数据超限,发送队列不能超过16M大小。
806
+ */
807
+ 10001 |
808
+ /**
809
+ * websocket未连接
810
+ */
811
+ 10002 |
812
+ /**
813
+ * websocket系统错误
814
+ */
815
+ 602001;
396
816
 
397
817
  /**
398
818
  * 发送失败的错误回调参数
399
819
  */
400
820
  export interface SendSocketMessageFail extends IUniError {
401
- errCode: SendSocketMessageErrorCode;
821
+ errCode: SendSocketMessageErrorCode;
402
822
  };
403
823
  export type SendSocketMessageOptions = {
404
- /**
405
- * 需要发送的内容
406
- * @type string | ArrayBuffer
407
- * @type {SocketDataOptions}
408
- * @uniPlatform
409
- * {
410
- * "app": {
411
- * "android": {
412
- * "osVer": "5.0",
413
- * "uniVer": "√",
414
- * "unixVer": "3.9+"
415
- * },
416
- * "ios": {
417
- * "osVer": "12.0",
418
- * "uniVer": "√",
419
- * "unixVer": "4.11"
420
- * },
421
- * "harmony": {
422
- * "osVer": "3.0",
423
- * "uniVer": "4.23",
424
- * "unixVer": "x"
425
- * }
426
- * }
427
- * }
428
- */
429
- data: any,
430
- /**
431
- * 接口调用成功的回调函数
432
- * @defaultValue null
433
- */
434
- success?: ((result: GeneralCallbackResult) => void) | null,
435
- /**
436
- * 接口调用失败的回调函数
437
- * @defaultValue null
438
- */
439
- fail?: ((result: SendSocketMessageFail) => void) | null,
440
- /**
441
- * 接口调用结束的回调函数(调用成功、失败都会执行)
442
- * @defaultValue null
443
- */
444
- complete?: ((result: any) => void) | null
824
+ /**
825
+ * 需要发送的内容
826
+ * @type string | ArrayBuffer
827
+ * @type {SocketDataOptions}
828
+ * @uniPlatform
829
+ * {
830
+ * "app": {
831
+ * "android": {
832
+ * "osVer": "5.0",
833
+ * "uniVer": "√",
834
+ * "unixVer": "3.9+"
835
+ * },
836
+ * "ios": {
837
+ * "osVer": "12.0",
838
+ * "uniVer": "√",
839
+ * "unixVer": "4.11"
840
+ * },
841
+ * "harmony": {
842
+ * "osVer": "3.0",
843
+ * "uniVer": "4.23",
844
+ * "unixVer": "x"
845
+ * }
846
+ * },
847
+ * "mp": {
848
+ * "weixin": {
849
+ * "hostVer": "√",
850
+ * "uniVer": "√",
851
+ * "unixVer": "4.41"
852
+ * },
853
+ * "alipay": {
854
+ * "hostVer": "√",
855
+ * "uniVer": "√",
856
+ * "unixVer": "x"
857
+ * },
858
+ * "baidu": {
859
+ * "hostVer": "√",
860
+ * "uniVer": "√",
861
+ * "unixVer": "x"
862
+ * },
863
+ * "toutiao": {
864
+ * "hostVer": "√",
865
+ * "uniVer": "√",
866
+ * "unixVer": "x"
867
+ * },
868
+ * "lark": {
869
+ * "hostVer": "√",
870
+ * "uniVer": "√",
871
+ * "unixVer": "x"
872
+ * },
873
+ * "qq": {
874
+ * "hostVer": "√",
875
+ * "uniVer": "√",
876
+ * "unixVer": "x"
877
+ * },
878
+ * "kuaishou": {
879
+ * "hostVer": "√",
880
+ * "uniVer": "√",
881
+ * "unixVer": "x"
882
+ * },
883
+ * "jd": {
884
+ * "hostVer": "√",
885
+ * "uniVer": "√",
886
+ * "unixVer": "x"
887
+ * }
888
+ * }
889
+ * }
890
+ */
891
+ data: any,
892
+ /**
893
+ * 接口调用成功的回调函数
894
+ * @defaultValue null
895
+ */
896
+ success?: ((result: GeneralCallbackResult) => void) | null,
897
+ /**
898
+ * 接口调用失败的回调函数
899
+ * @defaultValue null
900
+ */
901
+ fail?: ((result: SendSocketMessageFail) => void) | null,
902
+ /**
903
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
904
+ * @defaultValue null
905
+ */
906
+ complete?: ((result: any) => void) | null
445
907
  };
446
908
  export type CloseSocketOptions = {
447
- /**
448
- * 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。如果这个参数没有被指定,默认的取值是1000 (表示正常连接关闭)
449
- * @defaultValue 1000
450
- * @uniPlatform
451
- * {
452
- * "app": {
453
- * "android": {
454
- * "osVer": "5.0",
455
- * "uniVer": "√",
456
- * "unixVer": "3.9+"
457
- * },
458
- * "ios": {
459
- * "osVer": "12.0",
460
- * "uniVer": "√",
461
- * "unixVer": "4.11"
462
- * },
463
- * "harmony": {
464
- * "osVer": "3.0",
465
- * "uniVer": "4.23",
466
- * "unixVer": "x"
467
- * }
468
- * }
469
- * }
470
- */
471
- code?: number | null,
472
- /**
473
- * 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于123字节的UTF-8 文本(不是字符)
474
- * @defaultValue ""
475
- * @uniPlatform
476
- * {
477
- * "app": {
478
- * "android": {
479
- * "osVer": "5.0",
480
- * "uniVer": "√",
481
- * "unixVer": "3.9+"
482
- * },
483
- * "ios": {
484
- * "osVer": "12.0",
485
- * "uniVer": "√",
486
- * "unixVer": "4.11"
487
- * },
488
- * "harmony": {
489
- * "osVer": "3.0",
490
- * "uniVer": "4.23",
491
- * "unixVer": "x"
492
- * }
493
- * }
494
- * }
495
- */
496
- reason?: string | null,
497
- /**
498
- * 接口调用成功的回调函数
499
- * @defaultValue null
500
- */
501
- success?: ((result: GeneralCallbackResult) => void) | null,
502
- /**
503
- * 接口调用失败的回调函数
504
- * @defaultValue null
505
- */
506
- fail?: ((result: GeneralCallbackResult) => void) | null,
507
- /**
508
- * 接口调用结束的回调函数(调用成功、失败都会执行)
509
- * @defaultValue null
510
- */
511
- complete?: ((result: GeneralCallbackResult) => void) | null
909
+ /**
910
+ * 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。如果这个参数没有被指定,默认的取值是1000 (表示正常连接关闭)
911
+ * @defaultValue 1000
912
+ * @uniPlatform
913
+ * {
914
+ * "app": {
915
+ * "android": {
916
+ * "osVer": "5.0",
917
+ * "uniVer": "√",
918
+ * "unixVer": "3.9+"
919
+ * },
920
+ * "ios": {
921
+ * "osVer": "12.0",
922
+ * "uniVer": "√",
923
+ * "unixVer": "4.11"
924
+ * },
925
+ * "harmony": {
926
+ * "osVer": "3.0",
927
+ * "uniVer": "4.23",
928
+ * "unixVer": "x"
929
+ * }
930
+ * },
931
+ * "mp": {
932
+ * "weixin": {
933
+ * "hostVer": "√",
934
+ * "uniVer": "√",
935
+ * "unixVer": "4.41"
936
+ * },
937
+ * "alipay": {
938
+ * "hostVer": "√",
939
+ * "uniVer": "√",
940
+ * "unixVer": "x"
941
+ * },
942
+ * "baidu": {
943
+ * "hostVer": "",
944
+ * "uniVer": "√",
945
+ * "unixVer": "x"
946
+ * },
947
+ * "toutiao": {
948
+ * "hostVer": "",
949
+ * "uniVer": "√",
950
+ * "unixVer": "x"
951
+ * },
952
+ * "lark": {
953
+ * "hostVer": "",
954
+ * "uniVer": "√",
955
+ * "unixVer": "x"
956
+ * },
957
+ * "qq": {
958
+ * "hostVer": "√",
959
+ * "uniVer": "√",
960
+ * "unixVer": "x"
961
+ * },
962
+ * "kuaishou": {
963
+ * "hostVer": "√",
964
+ * "uniVer": "√",
965
+ * "unixVer": "x"
966
+ * },
967
+ * "jd": {
968
+ * "hostVer": "√",
969
+ * "uniVer": "√",
970
+ * "unixVer": "x"
971
+ * }
972
+ * }
973
+ * }
974
+ */
975
+ code?: number | null,
976
+ /**
977
+ * 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于123字节的UTF-8 文本(不是字符)
978
+ * @defaultValue ""
979
+ * @uniPlatform
980
+ * {
981
+ * "app": {
982
+ * "android": {
983
+ * "osVer": "5.0",
984
+ * "uniVer": "√",
985
+ * "unixVer": "3.9+"
986
+ * },
987
+ * "ios": {
988
+ * "osVer": "12.0",
989
+ * "uniVer": "√",
990
+ * "unixVer": "4.11"
991
+ * },
992
+ * "harmony": {
993
+ * "osVer": "3.0",
994
+ * "uniVer": "4.23",
995
+ * "unixVer": "x"
996
+ * }
997
+ * },
998
+ * "mp": {
999
+ * "weixin": {
1000
+ * "hostVer": "√",
1001
+ * "uniVer": "√",
1002
+ * "unixVer": "4.41"
1003
+ * },
1004
+ * "alipay": {
1005
+ * "hostVer": "√",
1006
+ * "uniVer": "√",
1007
+ * "unixVer": "x"
1008
+ * },
1009
+ * "baidu": {
1010
+ * "hostVer": "√",
1011
+ * "uniVer": "√",
1012
+ * "unixVer": "x"
1013
+ * },
1014
+ * "toutiao": {
1015
+ * "hostVer": "√",
1016
+ * "uniVer": "√",
1017
+ * "unixVer": "x"
1018
+ * },
1019
+ * "lark": {
1020
+ * "hostVer": "√",
1021
+ * "uniVer": "√",
1022
+ * "unixVer": "x"
1023
+ * },
1024
+ * "qq": {
1025
+ * "hostVer": "√",
1026
+ * "uniVer": "√",
1027
+ * "unixVer": "x"
1028
+ * },
1029
+ * "kuaishou": {
1030
+ * "hostVer": "√",
1031
+ * "uniVer": "√",
1032
+ * "unixVer": "x"
1033
+ * },
1034
+ * "jd": {
1035
+ * "hostVer": "√",
1036
+ * "uniVer": "√",
1037
+ * "unixVer": "x"
1038
+ * }
1039
+ * }
1040
+ * }
1041
+ */
1042
+ reason?: string | null,
1043
+ /**
1044
+ * 接口调用成功的回调函数
1045
+ * @defaultValue null
1046
+ */
1047
+ success?: ((result: GeneralCallbackResult) => void) | null,
1048
+ /**
1049
+ * 接口调用失败的回调函数
1050
+ * @defaultValue null
1051
+ */
1052
+ fail?: ((result: GeneralCallbackResult) => void) | null,
1053
+ /**
1054
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
1055
+ * @defaultValue null
1056
+ */
1057
+ complete?: ((result: GeneralCallbackResult) => void) | null
512
1058
  };
513
1059
  export type OnSocketOpenCallbackResult = {
514
- /**
515
- * 连接成功的 HTTP 响应 Header
516
- * @uniPlatform
517
- * {
518
- * "app": {
519
- * "android": {
520
- * "osVer": "5.0",
521
- * "uniVer": "√",
522
- * "unixVer": "3.9+"
523
- * },
524
- * "ios": {
525
- * "osVer": "12.0",
526
- * "uniVer": "√",
527
- * "unixVer": "4.11"
528
- * },
529
- * "harmony": {
530
- * "osVer": "3.0",
531
- * "uniVer": "4.23",
532
- * "unixVer": "x"
533
- * }
534
- * }
535
- * }
536
- */
537
- header: any
1060
+ /**
1061
+ * 连接成功的 HTTP 响应 Header
1062
+ * @uniPlatform
1063
+ * {
1064
+ * "app": {
1065
+ * "android": {
1066
+ * "osVer": "5.0",
1067
+ * "uniVer": "√",
1068
+ * "unixVer": "3.9+"
1069
+ * },
1070
+ * "ios": {
1071
+ * "osVer": "12.0",
1072
+ * "uniVer": "√",
1073
+ * "unixVer": "4.11"
1074
+ * },
1075
+ * "harmony": {
1076
+ * "osVer": "3.0",
1077
+ * "uniVer": "4.23",
1078
+ * "unixVer": "x"
1079
+ * }
1080
+ * },
1081
+ * "mp": {
1082
+ * "weixin": {
1083
+ * "hostVer": "√",
1084
+ * "uniVer": "√",
1085
+ * "unixVer": "4.41"
1086
+ * },
1087
+ * "alipay": {
1088
+ * "hostVer": "√",
1089
+ * "uniVer": "√",
1090
+ * "unixVer": "x"
1091
+ * },
1092
+ * "baidu": {
1093
+ * "hostVer": "√",
1094
+ * "uniVer": "√",
1095
+ * "unixVer": "x"
1096
+ * },
1097
+ * "toutiao": {
1098
+ * "hostVer": "√",
1099
+ * "uniVer": "√",
1100
+ * "unixVer": "x"
1101
+ * },
1102
+ * "lark": {
1103
+ * "hostVer": "√",
1104
+ * "uniVer": "√",
1105
+ * "unixVer": "x"
1106
+ * },
1107
+ * "qq": {
1108
+ * "hostVer": "√",
1109
+ * "uniVer": "√",
1110
+ * "unixVer": "x"
1111
+ * },
1112
+ * "kuaishou": {
1113
+ * "hostVer": "√",
1114
+ * "uniVer": "√",
1115
+ * "unixVer": "x"
1116
+ * },
1117
+ * "jd": {
1118
+ * "hostVer": "√",
1119
+ * "uniVer": "√",
1120
+ * "unixVer": "x"
1121
+ * }
1122
+ * }
1123
+ * }
1124
+ */
1125
+ header: any
538
1126
  };
539
1127
  export type OnSocketMessageCallbackResult = {
540
- /**
541
- * 服务器返回的消息
542
- * @type {SocketDataOptions}
543
- * @uniPlatform
544
- * {
545
- * "app": {
546
- * "android": {
547
- * "osVer": "5.0",
548
- * "uniVer": "√",
549
- * "unixVer": "3.9+"
550
- * },
551
- * "ios": {
552
- * "osVer": "12.0",
553
- * "uniVer": "√",
554
- * "unixVer": "4.11"
555
- * },
556
- * "harmony": {
557
- * "osVer": "3.0",
558
- * "uniVer": "4.23",
559
- * "unixVer": "x"
560
- * }
561
- * }
562
- * }
563
- */
564
- data: any
1128
+ /**
1129
+ * 服务器返回的消息
1130
+ * @type {SocketDataOptions}
1131
+ * @uniPlatform
1132
+ * {
1133
+ * "app": {
1134
+ * "android": {
1135
+ * "osVer": "5.0",
1136
+ * "uniVer": "√",
1137
+ * "unixVer": "3.9+"
1138
+ * },
1139
+ * "ios": {
1140
+ * "osVer": "12.0",
1141
+ * "uniVer": "√",
1142
+ * "unixVer": "4.11"
1143
+ * },
1144
+ * "harmony": {
1145
+ * "osVer": "3.0",
1146
+ * "uniVer": "4.23",
1147
+ * "unixVer": "x"
1148
+ * }
1149
+ * },
1150
+ * "mp": {
1151
+ * "weixin": {
1152
+ * "hostVer": "√",
1153
+ * "uniVer": "√",
1154
+ * "unixVer": "4.41"
1155
+ * },
1156
+ * "alipay": {
1157
+ * "hostVer": "√",
1158
+ * "uniVer": "√",
1159
+ * "unixVer": "x"
1160
+ * },
1161
+ * "baidu": {
1162
+ * "hostVer": "√",
1163
+ * "uniVer": "√",
1164
+ * "unixVer": "x"
1165
+ * },
1166
+ * "toutiao": {
1167
+ * "hostVer": "√",
1168
+ * "uniVer": "√",
1169
+ * "unixVer": "x"
1170
+ * },
1171
+ * "lark": {
1172
+ * "hostVer": "√",
1173
+ * "uniVer": "√",
1174
+ * "unixVer": "x"
1175
+ * },
1176
+ * "qq": {
1177
+ * "hostVer": "√",
1178
+ * "uniVer": "√",
1179
+ * "unixVer": "x"
1180
+ * },
1181
+ * "kuaishou": {
1182
+ * "hostVer": "√",
1183
+ * "uniVer": "√",
1184
+ * "unixVer": "x"
1185
+ * },
1186
+ * "jd": {
1187
+ * "hostVer": "√",
1188
+ * "uniVer": "√",
1189
+ * "unixVer": "x"
1190
+ * }
1191
+ * }
1192
+ * }
1193
+ */
1194
+ data: any
565
1195
  };
566
1196
  export interface SocketTask {
567
- /**
568
- * 通过 WebSocket 连接发送数据
569
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-send
570
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#send
571
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#send
572
- * @uniPlatform
573
- * {
574
- * "app": {
575
- * "android": {
576
- * "osVer": "4.4",
577
- * "uniVer": "√",
578
- * "unixVer": "3.9+"
579
- * },
580
- * "ios": {
581
- * "osVer": "12.0",
582
- * "uniVer": "√",
583
- * "unixVer": "4.11"
584
- * },
585
- * "harmony": {
586
- * "osVer": "3.0",
587
- * "uniVer": "4.23",
588
- * "unixVer": "x"
589
- * }
590
- * },
591
- * "web": {
592
- * "uniVer": "√",
593
- * "unixVer": "4.0"
594
- * }
595
- * }
596
- * @example
597
- ```typescript
598
- task.send({data:"halo"});
599
- ```
600
- */
601
- send(options: SendSocketMessageOptions): void;
602
- /**
603
- * 关闭 WebSocket 连接
604
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-close
605
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#close
606
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#close
607
- * @uniPlatform
608
- * {
609
- * "app": {
610
- * "android": {
611
- * "osVer": "4.4",
612
- * "uniVer": "√",
613
- * "unixVer": "3.9+"
614
- * },
615
- * "ios": {
616
- * "osVer": "12.0",
617
- * "uniVer": "√",
618
- * "unixVer": "4.11"
619
- * },
620
- * "harmony": {
621
- * "osVer": "3.0",
622
- * "uniVer": "4.23",
623
- * "unixVer": "x"
624
- * }
625
- * },
626
- * "web": {
627
- * "uniVer": "√",
628
- * "unixVer": "4.0"
629
- * }
630
- * }
631
- * @example
632
- ```typescript
633
- task.close();
634
- ```
635
- */
636
- close(options: CloseSocketOptions): void;
637
- /**
638
- * 监听 WebSocket 连接打开事件
639
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onopen
640
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onopen
641
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onopen
642
- * @uniPlatform
643
- * {
644
- * "app": {
645
- * "android": {
646
- * "osVer": "4.4",
647
- * "uniVer": "√",
648
- * "unixVer": "3.9+"
649
- * },
650
- * "ios": {
651
- * "osVer": "12.0",
652
- * "uniVer": "√",
653
- * "unixVer": "4.11"
654
- * },
655
- * "harmony": {
656
- * "osVer": "3.0",
657
- * "uniVer": "4.23",
658
- * "unixVer": "x"
659
- * }
660
- * },
661
- * "web": {
662
- * "uniVer": "√",
663
- * "unixVer": "4.0"
664
- * }
665
- * }
666
- * @example
667
- ```typescript
668
- task.onOpen((res) => {})
669
- ```
670
- */
671
- onOpen(callback: (result: OnSocketOpenCallbackResult) => void): void;
672
- /**
673
- * 监听 WebSocket 连接关闭事件
674
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onclose
675
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onclose
676
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onclose
677
- * @uniPlatform
678
- * {
679
- * "app": {
680
- * "android": {
681
- * "osVer": "4.4",
682
- * "uniVer": "",
683
- * "unixVer": "3.9+"
684
- * },
685
- * "ios": {
686
- * "osVer": "12.0",
687
- * "uniVer": "",
688
- * "unixVer": "4.11"
689
- * },
690
- * "harmony": {
691
- * "osVer": "3.0",
692
- * "uniVer": "4.23",
693
- * "unixVer": "x"
694
- * }
695
- * },
696
- * "web": {
697
- * "uniVer": "",
698
- * "unixVer": "4.0"
699
- * }
700
- * }
701
- * @example
702
- ```typescript
703
- task.onClose((res) => {
704
- })
705
- ```
706
- */
707
- onClose(callback: (result: any) => void): void;
708
- /**
709
- * onError()
710
- * @description
711
- * 监听 WebSocket 错误
712
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onerror
713
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onerror
714
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onerror
715
- * @uniPlatform
716
- * {
717
- * "app": {
718
- * "android": {
719
- * "osVer": "4.4",
720
- * "uniVer": "√",
721
- * "unixVer": "3.9+"
722
- * },
723
- * "ios": {
724
- * "osVer": "12.0",
725
- * "uniVer": "√",
726
- * "unixVer": "4.11"
727
- * },
728
- * "harmony": {
729
- * "osVer": "3.0",
730
- * "uniVer": "4.23",
731
- * "unixVer": "x"
732
- * }
733
- * },
734
- * "web": {
735
- * "uniVer": "",
736
- * "unixVer": "4.0"
737
- * }
738
- * }
739
- * @example
740
- ```typescript
741
- task.onError((res) => {
742
- })
743
- ```
744
- */
745
- onError(callback: (result: GeneralCallbackResult) => void): void;
746
- /**
747
- * 监听 WebSocket 接受到服务器的消息事件
748
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onmessage
749
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onmessage
750
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onmessage
751
- * @uniPlatform
752
- * {
753
- * "app": {
754
- * "android": {
755
- * "osVer": "4.4",
756
- * "uniVer": "√",
757
- * "unixVer": "3.9+"
758
- * },
759
- * "ios": {
760
- * "osVer": "12.0",
761
- * "uniVer": "√",
762
- * "unixVer": "4.11"
763
- * },
764
- * "harmony": {
765
- * "osVer": "3.0",
766
- * "uniVer": "4.23",
767
- * "unixVer": "x"
768
- * }
769
- * },
770
- * "web": {
771
- * "uniVer": "√",
772
- * "unixVer": "4.0"
773
- * }
774
- * }
775
- * @example
776
- ```typescript
777
- task.onMessage((res) => {
778
- })
779
- ```
780
- */
781
- onMessage(callback: (result: OnSocketMessageCallbackResult) => void): void;
1197
+ /**
1198
+ * 通过 WebSocket 连接发送数据
1199
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-send
1200
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#send
1201
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#send
1202
+ * @uniPlatform
1203
+ * {
1204
+ * "app": {
1205
+ * "android": {
1206
+ * "osVer": "4.4",
1207
+ * "uniVer": "√",
1208
+ * "unixVer": "3.9+"
1209
+ * },
1210
+ * "ios": {
1211
+ * "osVer": "12.0",
1212
+ * "uniVer": "√",
1213
+ * "unixVer": "4.11"
1214
+ * },
1215
+ * "harmony": {
1216
+ * "osVer": "3.0",
1217
+ * "uniVer": "4.23",
1218
+ * "unixVer": "x"
1219
+ * }
1220
+ * },
1221
+ * "mp": {
1222
+ * "weixin": {
1223
+ * "hostVer": "",
1224
+ * "uniVer": "√",
1225
+ * "unixVer": "4.41"
1226
+ * },
1227
+ * "alipay": {
1228
+ * "hostVer": "",
1229
+ * "uniVer": "√",
1230
+ * "unixVer": "x"
1231
+ * },
1232
+ * "baidu": {
1233
+ * "hostVer": "√",
1234
+ * "uniVer": "√",
1235
+ * "unixVer": "x"
1236
+ * },
1237
+ * "toutiao": {
1238
+ * "hostVer": "√",
1239
+ * "uniVer": "√",
1240
+ * "unixVer": "x"
1241
+ * },
1242
+ * "lark": {
1243
+ * "hostVer": "",
1244
+ * "uniVer": "√",
1245
+ * "unixVer": "x"
1246
+ * },
1247
+ * "qq": {
1248
+ * "hostVer": "",
1249
+ * "uniVer": "√",
1250
+ * "unixVer": "x"
1251
+ * },
1252
+ * "kuaishou": {
1253
+ * "hostVer": "",
1254
+ * "uniVer": "√",
1255
+ * "unixVer": "x"
1256
+ * },
1257
+ * "jd": {
1258
+ * "hostVer": "",
1259
+ * "uniVer": "√",
1260
+ * "unixVer": "x"
1261
+ * }
1262
+ * },
1263
+ * "web": {
1264
+ * "uniVer": "√",
1265
+ * "unixVer": "4.0"
1266
+ * }
1267
+ * }
1268
+ * @example
1269
+ ```typescript
1270
+ task.send({data:"halo"});
1271
+ ```
1272
+ */
1273
+ send(options: SendSocketMessageOptions): void;
1274
+ /**
1275
+ * 关闭 WebSocket 连接
1276
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-close
1277
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#close
1278
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#close
1279
+ * @uniPlatform
1280
+ * {
1281
+ * "app": {
1282
+ * "android": {
1283
+ * "osVer": "4.4",
1284
+ * "uniVer": "√",
1285
+ * "unixVer": "3.9+"
1286
+ * },
1287
+ * "ios": {
1288
+ * "osVer": "12.0",
1289
+ * "uniVer": "√",
1290
+ * "unixVer": "4.11"
1291
+ * },
1292
+ * "harmony": {
1293
+ * "osVer": "3.0",
1294
+ * "uniVer": "4.23",
1295
+ * "unixVer": "x"
1296
+ * }
1297
+ * },
1298
+ * "mp": {
1299
+ * "weixin": {
1300
+ * "hostVer": "√",
1301
+ * "uniVer": "√",
1302
+ * "unixVer": "4.41"
1303
+ * },
1304
+ * "alipay": {
1305
+ * "hostVer": "√",
1306
+ * "uniVer": "√",
1307
+ * "unixVer": "x"
1308
+ * },
1309
+ * "baidu": {
1310
+ * "hostVer": "√",
1311
+ * "uniVer": "",
1312
+ * "unixVer": "x"
1313
+ * },
1314
+ * "toutiao": {
1315
+ * "hostVer": "√",
1316
+ * "uniVer": "",
1317
+ * "unixVer": "x"
1318
+ * },
1319
+ * "lark": {
1320
+ * "hostVer": "√",
1321
+ * "uniVer": "",
1322
+ * "unixVer": "x"
1323
+ * },
1324
+ * "qq": {
1325
+ * "hostVer": "√",
1326
+ * "uniVer": "√",
1327
+ * "unixVer": "x"
1328
+ * },
1329
+ * "kuaishou": {
1330
+ * "hostVer": "√",
1331
+ * "uniVer": "√",
1332
+ * "unixVer": "x"
1333
+ * },
1334
+ * "jd": {
1335
+ * "hostVer": "√",
1336
+ * "uniVer": "√",
1337
+ * "unixVer": "x"
1338
+ * }
1339
+ * },
1340
+ * "web": {
1341
+ * "uniVer": "√",
1342
+ * "unixVer": "4.0"
1343
+ * }
1344
+ * }
1345
+ * @example
1346
+ ```typescript
1347
+ task.close();
1348
+ ```
1349
+ */
1350
+ close(options: CloseSocketOptions): void;
1351
+ /**
1352
+ * 监听 WebSocket 连接打开事件
1353
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onopen
1354
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onopen
1355
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onopen
1356
+ * @uniPlatform
1357
+ * {
1358
+ * "app": {
1359
+ * "android": {
1360
+ * "osVer": "4.4",
1361
+ * "uniVer": "",
1362
+ * "unixVer": "3.9+"
1363
+ * },
1364
+ * "ios": {
1365
+ * "osVer": "12.0",
1366
+ * "uniVer": "",
1367
+ * "unixVer": "4.11"
1368
+ * },
1369
+ * "harmony": {
1370
+ * "osVer": "3.0",
1371
+ * "uniVer": "4.23",
1372
+ * "unixVer": "x"
1373
+ * }
1374
+ * },
1375
+ * "mp": {
1376
+ * "weixin": {
1377
+ * "hostVer": "√",
1378
+ * "uniVer": "√",
1379
+ * "unixVer": "4.41"
1380
+ * },
1381
+ * "alipay": {
1382
+ * "hostVer": "√",
1383
+ * "uniVer": "√",
1384
+ * "unixVer": "x"
1385
+ * },
1386
+ * "baidu": {
1387
+ * "hostVer": "",
1388
+ * "uniVer": "√",
1389
+ * "unixVer": "x"
1390
+ * },
1391
+ * "toutiao": {
1392
+ * "hostVer": "",
1393
+ * "uniVer": "√",
1394
+ * "unixVer": "x"
1395
+ * },
1396
+ * "lark": {
1397
+ * "hostVer": "",
1398
+ * "uniVer": "√",
1399
+ * "unixVer": "x"
1400
+ * },
1401
+ * "qq": {
1402
+ * "hostVer": "",
1403
+ * "uniVer": "√",
1404
+ * "unixVer": "x"
1405
+ * },
1406
+ * "kuaishou": {
1407
+ * "hostVer": "√",
1408
+ * "uniVer": "√",
1409
+ * "unixVer": "x"
1410
+ * },
1411
+ * "jd": {
1412
+ * "hostVer": "√",
1413
+ * "uniVer": "√",
1414
+ * "unixVer": "x"
1415
+ * }
1416
+ * },
1417
+ * "web": {
1418
+ * "uniVer": "√",
1419
+ * "unixVer": "4.0"
1420
+ * }
1421
+ * }
1422
+ * @example
1423
+ ```typescript
1424
+ task.onOpen((res) => {})
1425
+ ```
1426
+ */
1427
+ onOpen(callback: (result: OnSocketOpenCallbackResult) => void): void;
1428
+ /**
1429
+ * 监听 WebSocket 连接关闭事件
1430
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onclose
1431
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onclose
1432
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onclose
1433
+ * @uniPlatform
1434
+ * {
1435
+ * "app": {
1436
+ * "android": {
1437
+ * "osVer": "4.4",
1438
+ * "uniVer": "√",
1439
+ * "unixVer": "3.9+"
1440
+ * },
1441
+ * "ios": {
1442
+ * "osVer": "12.0",
1443
+ * "uniVer": "√",
1444
+ * "unixVer": "4.11"
1445
+ * },
1446
+ * "harmony": {
1447
+ * "osVer": "3.0",
1448
+ * "uniVer": "4.23",
1449
+ * "unixVer": "x"
1450
+ * }
1451
+ * },
1452
+ * "mp": {
1453
+ * "weixin": {
1454
+ * "hostVer": "√",
1455
+ * "uniVer": "√",
1456
+ * "unixVer": "4.41"
1457
+ * },
1458
+ * "alipay": {
1459
+ * "hostVer": "√",
1460
+ * "uniVer": "√",
1461
+ * "unixVer": "x"
1462
+ * },
1463
+ * "baidu": {
1464
+ * "hostVer": "√",
1465
+ * "uniVer": "√",
1466
+ * "unixVer": "x"
1467
+ * },
1468
+ * "toutiao": {
1469
+ * "hostVer": "√",
1470
+ * "uniVer": "√",
1471
+ * "unixVer": "x"
1472
+ * },
1473
+ * "lark": {
1474
+ * "hostVer": "√",
1475
+ * "uniVer": "√",
1476
+ * "unixVer": "x"
1477
+ * },
1478
+ * "qq": {
1479
+ * "hostVer": "√",
1480
+ * "uniVer": "√",
1481
+ * "unixVer": "x"
1482
+ * },
1483
+ * "kuaishou": {
1484
+ * "hostVer": "√",
1485
+ * "uniVer": "√",
1486
+ * "unixVer": "x"
1487
+ * },
1488
+ * "jd": {
1489
+ * "hostVer": "√",
1490
+ * "uniVer": "√",
1491
+ * "unixVer": "x"
1492
+ * }
1493
+ * },
1494
+ * "web": {
1495
+ * "uniVer": "√",
1496
+ * "unixVer": "4.0"
1497
+ * }
1498
+ * }
1499
+ * @example
1500
+ ```typescript
1501
+ task.onClose((res) => {
1502
+ })
1503
+ ```
1504
+ */
1505
+ onClose(callback: (result: any) => void): void;
1506
+ /**
1507
+ * onError()
1508
+ * @description
1509
+ * 监听 WebSocket 错误
1510
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onerror
1511
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onerror
1512
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onerror
1513
+ * @uniPlatform
1514
+ * {
1515
+ * "app": {
1516
+ * "android": {
1517
+ * "osVer": "4.4",
1518
+ * "uniVer": "√",
1519
+ * "unixVer": "3.9+"
1520
+ * },
1521
+ * "ios": {
1522
+ * "osVer": "12.0",
1523
+ * "uniVer": "√",
1524
+ * "unixVer": "4.11"
1525
+ * },
1526
+ * "harmony": {
1527
+ * "osVer": "3.0",
1528
+ * "uniVer": "4.23",
1529
+ * "unixVer": "x"
1530
+ * }
1531
+ * },
1532
+ * "mp": {
1533
+ * "weixin": {
1534
+ * "hostVer": "√",
1535
+ * "uniVer": "√",
1536
+ * "unixVer": "4.41"
1537
+ * },
1538
+ * "alipay": {
1539
+ * "hostVer": "√",
1540
+ * "uniVer": "√",
1541
+ * "unixVer": "x"
1542
+ * },
1543
+ * "baidu": {
1544
+ * "hostVer": "√",
1545
+ * "uniVer": "√",
1546
+ * "unixVer": "x"
1547
+ * },
1548
+ * "toutiao": {
1549
+ * "hostVer": "√",
1550
+ * "uniVer": "√",
1551
+ * "unixVer": "x"
1552
+ * },
1553
+ * "lark": {
1554
+ * "hostVer": "√",
1555
+ * "uniVer": "√",
1556
+ * "unixVer": "x"
1557
+ * },
1558
+ * "qq": {
1559
+ * "hostVer": "√",
1560
+ * "uniVer": "√",
1561
+ * "unixVer": "x"
1562
+ * },
1563
+ * "kuaishou": {
1564
+ * "hostVer": "√",
1565
+ * "uniVer": "√",
1566
+ * "unixVer": "x"
1567
+ * },
1568
+ * "jd": {
1569
+ * "hostVer": "√",
1570
+ * "uniVer": "√",
1571
+ * "unixVer": "x"
1572
+ * }
1573
+ * },
1574
+ * "web": {
1575
+ * "uniVer": "√",
1576
+ * "unixVer": "4.0"
1577
+ * }
1578
+ * }
1579
+ * @example
1580
+ ```typescript
1581
+ task.onError((res) => {
1582
+ })
1583
+ ```
1584
+ */
1585
+ onError(callback: (result: GeneralCallbackResult) => void): void;
1586
+ /**
1587
+ * 监听 WebSocket 接受到服务器的消息事件
1588
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onmessage
1589
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onmessage
1590
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onmessage
1591
+ * @uniPlatform
1592
+ * {
1593
+ * "app": {
1594
+ * "android": {
1595
+ * "osVer": "4.4",
1596
+ * "uniVer": "√",
1597
+ * "unixVer": "3.9+"
1598
+ * },
1599
+ * "ios": {
1600
+ * "osVer": "12.0",
1601
+ * "uniVer": "√",
1602
+ * "unixVer": "4.11"
1603
+ * },
1604
+ * "harmony": {
1605
+ * "osVer": "3.0",
1606
+ * "uniVer": "4.23",
1607
+ * "unixVer": "x"
1608
+ * }
1609
+ * },
1610
+ * "mp": {
1611
+ * "weixin": {
1612
+ * "hostVer": "√",
1613
+ * "uniVer": "√",
1614
+ * "unixVer": "4.41"
1615
+ * },
1616
+ * "alipay": {
1617
+ * "hostVer": "√",
1618
+ * "uniVer": "√",
1619
+ * "unixVer": "x"
1620
+ * },
1621
+ * "baidu": {
1622
+ * "hostVer": "√",
1623
+ * "uniVer": "√",
1624
+ * "unixVer": "x"
1625
+ * },
1626
+ * "toutiao": {
1627
+ * "hostVer": "√",
1628
+ * "uniVer": "√",
1629
+ * "unixVer": "x"
1630
+ * },
1631
+ * "lark": {
1632
+ * "hostVer": "√",
1633
+ * "uniVer": "√",
1634
+ * "unixVer": "x"
1635
+ * },
1636
+ * "qq": {
1637
+ * "hostVer": "√",
1638
+ * "uniVer": "√",
1639
+ * "unixVer": "x"
1640
+ * },
1641
+ * "kuaishou": {
1642
+ * "hostVer": "√",
1643
+ * "uniVer": "√",
1644
+ * "unixVer": "x"
1645
+ * },
1646
+ * "jd": {
1647
+ * "hostVer": "√",
1648
+ * "uniVer": "√",
1649
+ * "unixVer": "x"
1650
+ * }
1651
+ * },
1652
+ * "web": {
1653
+ * "uniVer": "√",
1654
+ * "unixVer": "4.0"
1655
+ * }
1656
+ * }
1657
+ * @example
1658
+ ```typescript
1659
+ task.onMessage((res) => {
1660
+ })
1661
+ ```
1662
+ */
1663
+ onMessage(callback: (result: OnSocketMessageCallbackResult) => void): void;
782
1664
  };
783
1665
  export type OnSocketOpenCallback = (result: OnSocketOpenCallbackResult) => void;
784
1666
 
785
1667
  export type OnSocketOpen = (options: OnSocketOpenCallback) => void;
786
1668
  export type OnSocketErrorCallbackResult = {
787
- /**
788
- * 错误信息
789
- */
790
- errMsg: string
1669
+ /**
1670
+ * 错误信息
1671
+ */
1672
+ errMsg: string
791
1673
  };
792
1674
  export type OnSocketErrorCallback = (result: OnSocketErrorCallbackResult) => void;
793
1675
 
@@ -800,54 +1682,138 @@ export type OnSocketMessage = (callback: OnSocketMessageCallback) => void;
800
1682
 
801
1683
  export type CloseSocket = (options: CloseSocketOptions) => void;
802
1684
  export type OnSocketCloseCallbackResult = {
803
- /**
804
- * 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。
805
- * @uniPlatform
806
- * {
807
- * "app": {
808
- * "android": {
809
- * "osVer": "5.0",
810
- * "uniVer": "√",
811
- * "unixVer": "3.9+"
812
- * },
813
- * "ios": {
814
- * "osVer": "12.0",
815
- * "uniVer": "√",
816
- * "unixVer": "4.11"
817
- * },
818
- * "harmony": {
819
- * "osVer": "3.0",
820
- * "uniVer": "4.23",
821
- * "unixVer": "x"
822
- * }
823
- * }
824
- * }
825
- */
826
- code: number,
827
- /**
828
- * 一个可读的字符串,表示连接被关闭的原因。
829
- * @uniPlatform
830
- * {
831
- * "app": {
832
- * "android": {
833
- * "osVer": "5.0",
834
- * "uniVer": "√",
835
- * "unixVer": "3.9+"
836
- * },
837
- * "ios": {
838
- * "osVer": "12.0",
839
- * "uniVer": "√",
840
- * "unixVer": "4.11"
841
- * },
842
- * "harmony": {
843
- * "osVer": "3.0",
844
- * "uniVer": "4.23",
845
- * "unixVer": "x"
846
- * }
847
- * }
848
- * }
849
- */
850
- reason: string
1685
+ /**
1686
+ * 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。
1687
+ * @uniPlatform
1688
+ * {
1689
+ * "app": {
1690
+ * "android": {
1691
+ * "osVer": "5.0",
1692
+ * "uniVer": "√",
1693
+ * "unixVer": "3.9+"
1694
+ * },
1695
+ * "ios": {
1696
+ * "osVer": "12.0",
1697
+ * "uniVer": "√",
1698
+ * "unixVer": "4.11"
1699
+ * },
1700
+ * "harmony": {
1701
+ * "osVer": "3.0",
1702
+ * "uniVer": "4.23",
1703
+ * "unixVer": "x"
1704
+ * }
1705
+ * },
1706
+ * "mp": {
1707
+ * "weixin": {
1708
+ * "hostVer": "√",
1709
+ * "uniVer": "√",
1710
+ * "unixVer": "4.41"
1711
+ * },
1712
+ * "alipay": {
1713
+ * "hostVer": "√",
1714
+ * "uniVer": "√",
1715
+ * "unixVer": "x"
1716
+ * },
1717
+ * "baidu": {
1718
+ * "hostVer": "√",
1719
+ * "uniVer": "√",
1720
+ * "unixVer": "x"
1721
+ * },
1722
+ * "toutiao": {
1723
+ * "hostVer": "√",
1724
+ * "uniVer": "√",
1725
+ * "unixVer": "x"
1726
+ * },
1727
+ * "lark": {
1728
+ * "hostVer": "√",
1729
+ * "uniVer": "√",
1730
+ * "unixVer": "x"
1731
+ * },
1732
+ * "qq": {
1733
+ * "hostVer": "√",
1734
+ * "uniVer": "√",
1735
+ * "unixVer": "x"
1736
+ * },
1737
+ * "kuaishou": {
1738
+ * "hostVer": "√",
1739
+ * "uniVer": "√",
1740
+ * "unixVer": "x"
1741
+ * },
1742
+ * "jd": {
1743
+ * "hostVer": "√",
1744
+ * "uniVer": "√",
1745
+ * "unixVer": "x"
1746
+ * }
1747
+ * }
1748
+ * }
1749
+ */
1750
+ code: number,
1751
+ /**
1752
+ * 一个可读的字符串,表示连接被关闭的原因。
1753
+ * @uniPlatform
1754
+ * {
1755
+ * "app": {
1756
+ * "android": {
1757
+ * "osVer": "5.0",
1758
+ * "uniVer": "√",
1759
+ * "unixVer": "3.9+"
1760
+ * },
1761
+ * "ios": {
1762
+ * "osVer": "12.0",
1763
+ * "uniVer": "√",
1764
+ * "unixVer": "4.11"
1765
+ * },
1766
+ * "harmony": {
1767
+ * "osVer": "3.0",
1768
+ * "uniVer": "4.23",
1769
+ * "unixVer": "x"
1770
+ * }
1771
+ * },
1772
+ * "mp": {
1773
+ * "weixin": {
1774
+ * "hostVer": "√",
1775
+ * "uniVer": "√",
1776
+ * "unixVer": "4.41"
1777
+ * },
1778
+ * "alipay": {
1779
+ * "hostVer": "√",
1780
+ * "uniVer": "√",
1781
+ * "unixVer": "x"
1782
+ * },
1783
+ * "baidu": {
1784
+ * "hostVer": "√",
1785
+ * "uniVer": "√",
1786
+ * "unixVer": "x"
1787
+ * },
1788
+ * "toutiao": {
1789
+ * "hostVer": "√",
1790
+ * "uniVer": "√",
1791
+ * "unixVer": "x"
1792
+ * },
1793
+ * "lark": {
1794
+ * "hostVer": "√",
1795
+ * "uniVer": "√",
1796
+ * "unixVer": "x"
1797
+ * },
1798
+ * "qq": {
1799
+ * "hostVer": "√",
1800
+ * "uniVer": "√",
1801
+ * "unixVer": "x"
1802
+ * },
1803
+ * "kuaishou": {
1804
+ * "hostVer": "√",
1805
+ * "uniVer": "√",
1806
+ * "unixVer": "x"
1807
+ * },
1808
+ * "jd": {
1809
+ * "hostVer": "√",
1810
+ * "uniVer": "√",
1811
+ * "unixVer": "x"
1812
+ * }
1813
+ * }
1814
+ * }
1815
+ */
1816
+ reason: string
851
1817
  };
852
1818
  export type OnSocketCloseCallback = (result: OnSocketCloseCallbackResult) => void;
853
1819