@dcloudio/uni-app-x 0.7.41 → 0.7.43

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 (44) hide show
  1. package/package.json +1 -1
  2. package/types/UniPage.d.ts +32 -77
  3. package/types/app.d.ts +39 -2
  4. package/types/native/CSSStyleDeclaration.d.ts +40 -7
  5. package/types/native/CanvasRenderingContext2D.d.ts +56 -6
  6. package/types/native/IUniElement.d.ts +31 -2
  7. package/types/native/UniAnimation.d.ts +578 -0
  8. package/types/native/UniAnimationPlaybackEvent.d.ts +12 -0
  9. package/types/native/UniNativePage.d.ts +1 -19
  10. package/types/native/UniSafeAreaInsets.d.ts +74 -0
  11. package/types/native/global.d.ts +6 -2
  12. package/types/native/index.d.ts +3 -1
  13. package/types/uni/uni-map-tencent-global.d.ts +5 -1
  14. package/types/uni/uni-map-tencent-map.d.ts +7 -0
  15. package/types/uni/uts-plugin-api/global.d.ts +3 -0
  16. package/types/uni/uts-plugin-api/index.d.ts +3 -0
  17. package/types/uni/uts-plugin-api/lib/uni-actionSheet/utssdk/interface.d.ts +680 -51
  18. package/types/uni/uts-plugin-api/lib/uni-chooseMedia/utssdk/global.d.ts +32 -0
  19. package/types/uni/uts-plugin-api/lib/uni-chooseMedia/utssdk/index.d.ts +15 -0
  20. package/types/uni/uts-plugin-api/lib/uni-chooseMedia/utssdk/interface.d.ts +685 -0
  21. package/types/uni/uts-plugin-api/lib/uni-document/utssdk/global.d.ts +10 -0
  22. package/types/uni/uts-plugin-api/lib/uni-document/utssdk/index.d.ts +4 -0
  23. package/types/uni/uts-plugin-api/lib/uni-document/utssdk/interface.d.ts +76 -0
  24. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/interface.d.ts +105 -104
  25. package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/interface.d.ts +75 -1
  26. package/types/uni/uts-plugin-api/lib/uni-loadFontFace/utssdk/global.d.ts +2 -0
  27. package/types/uni/uts-plugin-api/lib/uni-loadFontFace/utssdk/index.d.ts +1 -0
  28. package/types/uni/uts-plugin-api/lib/uni-loadFontFace/utssdk/interface.d.ts +4 -5
  29. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/global.d.ts +0 -22
  30. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/index.d.ts +0 -11
  31. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/interface.d.ts +171 -896
  32. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/interface.d.ts +1 -1
  33. package/types/uni/uts-plugin-api/lib/uni-previewImage/utssdk/global.d.ts +46 -0
  34. package/types/uni/uts-plugin-api/lib/uni-previewImage/utssdk/index.d.ts +22 -0
  35. package/types/uni/uts-plugin-api/lib/uni-previewImage/utssdk/interface.d.ts +339 -0
  36. package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/interface.d.ts +1 -1
  37. package/types/uni/uts-plugin-api/lib/uni-theme/utssdk/global.d.ts +4 -0
  38. package/types/uni/uts-plugin-api/lib/uni-theme/utssdk/index.d.ts +2 -0
  39. package/types/uni/uts-plugin-api/lib/uni-theme/utssdk/interface.d.ts +6 -4
  40. package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/interface.d.ts +2187 -2066
  41. package/types/uni/uts-plugin-biz/lib/uni-crash/utssdk/interface.d.ts +1 -1
  42. package/types/uni/uts-plugin-biz/lib/uni-map-tencent/utssdk/interface.d.ts +268 -20
  43. package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/interface.d.ts +398 -203
  44. package/types/native/UniSafeArea.d.ts +0 -185
@@ -1,561 +1,599 @@
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
- * "app": {
9
- * "android": {
10
- * "osVer": "4.4",
11
- * "uniVer": "√",
12
- * "unixVer": "3.9+"
13
- * },
14
- * "ios": {
15
- * "osVer": "12.0",
16
- * "uniVer": "√",
17
- * "unixVer": "4.11"
18
- * },
19
- * "harmony": {
20
- * "osVer": "3.0",
21
- * "uniVer": "4.23",
22
- * "unixVer": "x"
23
- * }
24
- * },
25
- * "mp": {
26
- * "weixin": {
27
- * "hostVer": "1.9.6",
28
- * "uniVer": "√",
29
- * "unixVer": "4.41"
30
- * },
31
- * "alipay": {
32
- * "hostVer": "√",
33
- * "uniVer": "",
34
- * "unixVer": "x"
35
- * },
36
- * "baidu": {
37
- * "hostVer": "√",
38
- * "uniVer": "",
39
- * "unixVer": "x"
40
- * },
41
- * "toutiao": {
42
- * "hostVer": "√",
43
- * "uniVer": "",
44
- * "unixVer": "x"
45
- * },
46
- * "lark": {
47
- * "hostVer": "√",
48
- * "uniVer": "",
49
- * "unixVer": "x"
50
- * },
51
- * "qq": {
52
- * "hostVer": "√",
53
- * "uniVer": "",
54
- * "unixVer": "x"
55
- * },
56
- * "kuaishou": {
57
- * "hostVer": "√",
58
- * "uniVer": "",
59
- * "unixVer": "x"
60
- * },
61
- * "jd": {
62
- * "hostVer": "√",
63
- * "uniVer": "",
64
- * "unixVer": "x"
65
- * }
66
- * },
67
- * "web": {
68
- * "uniVer": "",
69
- * "unixVer": "4.0"
70
- * }
71
- * }
72
- * @example
73
- ```typescript
74
- uni.connectSocket({
75
- url: "ws://192.168.12.106:8080/ws",
76
- complete: (e) => {
77
- console.log("socket :", e);
78
- }
79
- });
80
- ```
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
+ * "app": {
9
+ * "android": {
10
+ * "osVer": "4.4",
11
+ * "uniVer": "√",
12
+ * "uniUtsPlugin": "3.91",
13
+ * "unixVer": "3.91",
14
+ * "unixUtsPlugin": "3.91"
15
+ * },
16
+ * "ios": {
17
+ * "osVer": "12.0",
18
+ * "uniVer": "√",
19
+ * "uniUtsPlugin": "4.11",
20
+ * "unixVer": "4.11",
21
+ * "unixUtsPlugin": "4.11"
22
+ * },
23
+ * "harmony": {
24
+ * "osVer": "3.0",
25
+ * "uniVer": "4.23",
26
+ * "unixVer": "x"
27
+ * }
28
+ * },
29
+ * "mp": {
30
+ * "weixin": {
31
+ * "hostVer": "1.9.6",
32
+ * "uniVer": "√",
33
+ * "unixVer": "4.41"
34
+ * },
35
+ * "alipay": {
36
+ * "hostVer": "√",
37
+ * "uniVer": "√",
38
+ * "unixVer": "x"
39
+ * },
40
+ * "baidu": {
41
+ * "hostVer": "√",
42
+ * "uniVer": "√",
43
+ * "unixVer": "x"
44
+ * },
45
+ * "toutiao": {
46
+ * "hostVer": "√",
47
+ * "uniVer": "√",
48
+ * "unixVer": "x"
49
+ * },
50
+ * "lark": {
51
+ * "hostVer": "√",
52
+ * "uniVer": "√",
53
+ * "unixVer": "x"
54
+ * },
55
+ * "qq": {
56
+ * "hostVer": "√",
57
+ * "uniVer": "√",
58
+ * "unixVer": "x"
59
+ * },
60
+ * "kuaishou": {
61
+ * "hostVer": "√",
62
+ * "uniVer": "√",
63
+ * "unixVer": "x"
64
+ * },
65
+ * "jd": {
66
+ * "hostVer": "√",
67
+ * "uniVer": "√",
68
+ * "unixVer": "x"
69
+ * }
70
+ * },
71
+ * "web": {
72
+ * "uniVer": "√",
73
+ * "unixVer": "4.0"
74
+ * }
75
+ * }
76
+ * @example
77
+ ```typescript
78
+ uni.connectSocket({
79
+ url: "ws://192.168.12.106:8080/ws",
80
+ complete: (e) => {
81
+ console.log("socket :", e);
82
+ }
83
+ });
84
+ ```
81
85
  * @tutorial_weixin https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html
82
86
  */
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
- * "app": {
92
- * "android": {
93
- * "osVer": "4.4",
94
- * "uniVer": "√",
95
- * "unixVer": "3.9+"
96
- * },
97
- * "ios": {
98
- * "osVer": "12.0",
99
- * "uniVer": "",
100
- * "unixVer": "4.11"
101
- * },
102
- * "harmony": {
103
- * "osVer": "3.0",
104
- * "uniVer": "4.23",
105
- * "unixVer": "x"
106
- * }
107
- * },
108
- * "mp": {
109
- * "weixin": {
110
- * "hostVer": "",
111
- * "uniVer": "",
112
- * "unixVer": "4.41"
113
- * },
114
- * "alipay": {
115
- * "hostVer": "√",
116
- * "uniVer": "√",
117
- * "unixVer": "x"
118
- * },
119
- * "baidu": {
120
- * "hostVer": "√",
121
- * "uniVer": "√",
122
- * "unixVer": "x"
123
- * },
124
- * "toutiao": {
125
- * "hostVer": "√",
126
- * "uniVer": "√",
127
- * "unixVer": "x"
128
- * },
129
- * "lark": {
130
- * "hostVer": "√",
131
- * "uniVer": "√",
132
- * "unixVer": "x"
133
- * },
134
- * "qq": {
135
- * "hostVer": "√",
136
- * "uniVer": "√",
137
- * "unixVer": "x"
138
- * },
139
- * "kuaishou": {
140
- * "hostVer": "√",
141
- * "uniVer": "√",
142
- * "unixVer": "x"
143
- * },
144
- * "jd": {
145
- * "hostVer": "√",
146
- * "uniVer": "√",
147
- * "unixVer": "x"
148
- * }
149
- * },
150
- * "web": {
151
- * "uniVer": "√",
152
- * "unixVer": "4.0"
153
- * }
154
- * }
155
- * @example
156
- ```typescript
157
- uni.onSocketOpen(function (res) {
158
- console.log('WebSocket连接已打开!');
159
- });
160
- ```
87
+ connectSocket(options: ConnectSocketOptions): SocketTask;
88
+
89
+ /**
90
+ * @description
91
+ * 监听WebSocket连接打开事件。
92
+ * @deprecated 已废弃,使用 SocketTask 的 onOpen 替换。
93
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketopen
94
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketopen
95
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketopen
96
+ * @uniPlatform {
97
+ * "app": {
98
+ * "android": {
99
+ * "osVer": "4.4",
100
+ * "uniVer": "√",
101
+ * "uniUtsPlugin": "3.91",
102
+ * "unixVer": "3.91",
103
+ * "unixUtsPlugin": "3.91"
104
+ * },
105
+ * "ios": {
106
+ * "osVer": "12.0",
107
+ * "uniVer": "",
108
+ * "uniUtsPlugin": "4.11",
109
+ * "unixVer": "4.11",
110
+ * "unixUtsPlugin": "4.11"
111
+ * },
112
+ * "harmony": {
113
+ * "osVer": "3.0",
114
+ * "uniVer": "4.23",
115
+ * "unixVer": "x"
116
+ * }
117
+ * },
118
+ * "mp": {
119
+ * "weixin": {
120
+ * "hostVer": "√",
121
+ * "uniVer": "",
122
+ * "unixVer": "4.41"
123
+ * },
124
+ * "alipay": {
125
+ * "hostVer": "√",
126
+ * "uniVer": "",
127
+ * "unixVer": "x"
128
+ * },
129
+ * "baidu": {
130
+ * "hostVer": "√",
131
+ * "uniVer": "",
132
+ * "unixVer": "x"
133
+ * },
134
+ * "toutiao": {
135
+ * "hostVer": "√",
136
+ * "uniVer": "",
137
+ * "unixVer": "x"
138
+ * },
139
+ * "lark": {
140
+ * "hostVer": "√",
141
+ * "uniVer": "",
142
+ * "unixVer": "x"
143
+ * },
144
+ * "qq": {
145
+ * "hostVer": "√",
146
+ * "uniVer": "",
147
+ * "unixVer": "x"
148
+ * },
149
+ * "kuaishou": {
150
+ * "hostVer": "√",
151
+ * "uniVer": "",
152
+ * "unixVer": "x"
153
+ * },
154
+ * "jd": {
155
+ * "hostVer": "√",
156
+ * "uniVer": "",
157
+ * "unixVer": "x"
158
+ * }
159
+ * },
160
+ * "web": {
161
+ * "uniVer": "√",
162
+ * "unixVer": "4.0"
163
+ * }
164
+ * }
165
+ * @example
166
+ ```typescript
167
+ uni.onSocketOpen(function (res) {
168
+ console.log('WebSocket连接已打开!');
169
+ });
170
+ ```
161
171
  * @tutorial_weixin https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketOpen.html
162
172
  */
163
- onSocketOpen(options: OnSocketOpenCallback): void;
173
+ onSocketOpen(options: OnSocketOpenCallback): void;
164
174
 
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
- * "app": {
172
- * "android": {
173
- * "osVer": "4.4",
174
- * "uniVer": "",
175
- * "unixVer": "3.9+"
176
- * },
177
- * "ios": {
178
- * "osVer": "12.0",
179
- * "uniVer": "√",
180
- * "unixVer": "4.11"
181
- * },
182
- * "harmony": {
183
- * "osVer": "3.0",
184
- * "uniVer": "4.23",
185
- * "unixVer": "x"
186
- * }
187
- * },
188
- * "mp": {
189
- * "weixin": {
190
- * "hostVer": "",
191
- * "uniVer": "√",
192
- * "unixVer": "4.41"
193
- * },
194
- * "alipay": {
195
- * "hostVer": "√",
196
- * "uniVer": "√",
197
- * "unixVer": "x"
198
- * },
199
- * "baidu": {
200
- * "hostVer": "√",
201
- * "uniVer": "√",
202
- * "unixVer": "x"
203
- * },
204
- * "toutiao": {
205
- * "hostVer": "√",
206
- * "uniVer": "√",
207
- * "unixVer": "x"
208
- * },
209
- * "lark": {
210
- * "hostVer": "√",
211
- * "uniVer": "√",
212
- * "unixVer": "x"
213
- * },
214
- * "qq": {
215
- * "hostVer": "√",
216
- * "uniVer": "√",
217
- * "unixVer": "x"
218
- * },
219
- * "kuaishou": {
220
- * "hostVer": "√",
221
- * "uniVer": "√",
222
- * "unixVer": "x"
223
- * },
224
- * "jd": {
225
- * "hostVer": "√",
226
- * "uniVer": "√",
227
- * "unixVer": "x"
228
- * }
229
- * },
230
- * "web": {
231
- * "uniVer": "√",
232
- * "unixVer": "4.0"
233
- * }
234
- * }
235
- * @example
236
- ```typescript
237
- uni.onSocketError(function (res) {
238
- console.log('WebSocket连接打开失败,请检查!');
239
- });
240
- ```
175
+ /**
176
+ * 监听WebSocket错误。
177
+ * @deprecated 已废弃,使用 SocketTask 的 onError 替换。
178
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketerror
179
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketerror
180
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketerror
181
+ * @uniPlatform {
182
+ * "app": {
183
+ * "android": {
184
+ * "osVer": "4.4",
185
+ * "uniVer": "",
186
+ * "uniUtsPlugin": "3.91",
187
+ * "unixVer": "3.91",
188
+ * "unixUtsPlugin": "3.91"
189
+ * },
190
+ * "ios": {
191
+ * "osVer": "12.0",
192
+ * "uniVer": "√",
193
+ * "uniUtsPlugin": "4.11",
194
+ * "unixVer": "4.11",
195
+ * "unixUtsPlugin": "4.11"
196
+ * },
197
+ * "harmony": {
198
+ * "osVer": "3.0",
199
+ * "uniVer": "4.23",
200
+ * "unixVer": "x"
201
+ * }
202
+ * },
203
+ * "mp": {
204
+ * "weixin": {
205
+ * "hostVer": "√",
206
+ * "uniVer": "√",
207
+ * "unixVer": "4.41"
208
+ * },
209
+ * "alipay": {
210
+ * "hostVer": "√",
211
+ * "uniVer": "√",
212
+ * "unixVer": "x"
213
+ * },
214
+ * "baidu": {
215
+ * "hostVer": "√",
216
+ * "uniVer": "√",
217
+ * "unixVer": "x"
218
+ * },
219
+ * "toutiao": {
220
+ * "hostVer": "√",
221
+ * "uniVer": "√",
222
+ * "unixVer": "x"
223
+ * },
224
+ * "lark": {
225
+ * "hostVer": "√",
226
+ * "uniVer": "√",
227
+ * "unixVer": "x"
228
+ * },
229
+ * "qq": {
230
+ * "hostVer": "√",
231
+ * "uniVer": "√",
232
+ * "unixVer": "x"
233
+ * },
234
+ * "kuaishou": {
235
+ * "hostVer": "√",
236
+ * "uniVer": "√",
237
+ * "unixVer": "x"
238
+ * },
239
+ * "jd": {
240
+ * "hostVer": "√",
241
+ * "uniVer": "√",
242
+ * "unixVer": "x"
243
+ * }
244
+ * },
245
+ * "web": {
246
+ * "uniVer": "√",
247
+ * "unixVer": "4.0"
248
+ * }
249
+ * }
250
+ * @example
251
+ ```typescript
252
+ uni.onSocketError(function (res) {
253
+ console.log('WebSocket连接打开失败,请检查!');
254
+ });
255
+ ```
241
256
  * @tutorial_weixin https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketError.html
242
257
  */
243
- onSocketError(callback: OnSocketErrorCallback): void;
258
+ onSocketError(callback: OnSocketErrorCallback): void;
244
259
 
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
- * "app": {
252
- * "android": {
253
- * "osVer": "4.4",
254
- * "uniVer": "",
255
- * "unixVer": "3.9+"
256
- * },
257
- * "ios": {
258
- * "osVer": "12.0",
259
- * "uniVer": "√",
260
- * "unixVer": "4.11"
261
- * },
262
- * "harmony": {
263
- * "osVer": "3,0",
264
- * "uniVer": "4.23",
265
- * "unixVer": "x"
266
- * }
267
- * },
268
- * "mp": {
269
- * "weixin": {
270
- * "hostVer": "",
271
- * "uniVer": "√",
272
- * "unixVer": "4.41"
273
- * },
274
- * "alipay": {
275
- * "hostVer": "√",
276
- * "uniVer": "√",
277
- * "unixVer": "x"
278
- * },
279
- * "baidu": {
280
- * "hostVer": "√",
281
- * "uniVer": "√",
282
- * "unixVer": "x"
283
- * },
284
- * "toutiao": {
285
- * "hostVer": "√",
286
- * "uniVer": "√",
287
- * "unixVer": "x"
288
- * },
289
- * "lark": {
290
- * "hostVer": "√",
291
- * "uniVer": "√",
292
- * "unixVer": "x"
293
- * },
294
- * "qq": {
295
- * "hostVer": "√",
296
- * "uniVer": "√",
297
- * "unixVer": "x"
298
- * },
299
- * "kuaishou": {
300
- * "hostVer": "√",
301
- * "uniVer": "√",
302
- * "unixVer": "x"
303
- * },
304
- * "jd": {
305
- * "hostVer": "√",
306
- * "uniVer": "√",
307
- * "unixVer": "x"
308
- * }
309
- * },
310
- * "web": {
311
- * "uniVer": "√",
312
- * "unixVer": "4.0"
313
- * }
314
- * }
315
- * @example
316
- ```typescript
317
- uni.sendSocketMessage({
318
- data: msg
319
- });
320
- ```
260
+ /**
261
+ * 通过 WebSocket 连接发送数据,需要先 uni.connectSocket,并在 uni.onSocketOpen 回调之后才能发送。
262
+ * @deprecated 已废弃,使用 SocketTask 的 send 替换。
263
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#sendsocketmessage
264
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#sendsocketmessage
265
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#sendsocketmessage
266
+ * @uniPlatform {
267
+ * "app": {
268
+ * "android": {
269
+ * "osVer": "4.4",
270
+ * "uniVer": "",
271
+ * "uniUtsPlugin": "3.91",
272
+ * "unixVer": "3.91",
273
+ * "unixUtsPlugin": "3.91"
274
+ * },
275
+ * "ios": {
276
+ * "osVer": "12.0",
277
+ * "uniVer": "√",
278
+ * "uniUtsPlugin": "4.11",
279
+ * "unixVer": "4.11",
280
+ * "unixUtsPlugin": "4.11"
281
+ * },
282
+ * "harmony": {
283
+ * "osVer": "3.0",
284
+ * "uniVer": "4.23",
285
+ * "unixVer": "x"
286
+ * }
287
+ * },
288
+ * "mp": {
289
+ * "weixin": {
290
+ * "hostVer": "√",
291
+ * "uniVer": "√",
292
+ * "unixVer": "4.41"
293
+ * },
294
+ * "alipay": {
295
+ * "hostVer": "√",
296
+ * "uniVer": "√",
297
+ * "unixVer": "x"
298
+ * },
299
+ * "baidu": {
300
+ * "hostVer": "√",
301
+ * "uniVer": "√",
302
+ * "unixVer": "x"
303
+ * },
304
+ * "toutiao": {
305
+ * "hostVer": "√",
306
+ * "uniVer": "√",
307
+ * "unixVer": "x"
308
+ * },
309
+ * "lark": {
310
+ * "hostVer": "√",
311
+ * "uniVer": "√",
312
+ * "unixVer": "x"
313
+ * },
314
+ * "qq": {
315
+ * "hostVer": "√",
316
+ * "uniVer": "√",
317
+ * "unixVer": "x"
318
+ * },
319
+ * "kuaishou": {
320
+ * "hostVer": "√",
321
+ * "uniVer": "√",
322
+ * "unixVer": "x"
323
+ * },
324
+ * "jd": {
325
+ * "hostVer": "√",
326
+ * "uniVer": "√",
327
+ * "unixVer": "x"
328
+ * }
329
+ * },
330
+ * "web": {
331
+ * "uniVer": "√",
332
+ * "unixVer": "4.0"
333
+ * }
334
+ * }
335
+ * @example
336
+ ```typescript
337
+ uni.sendSocketMessage({
338
+ data: msg
339
+ });
340
+ ```
321
341
  * @tutorial_weixin https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.sendSocketMessage.html
322
342
  */
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
- * "app": {
331
- * "android": {
332
- * "osVer": "4.4",
333
- * "uniVer": "√",
334
- * "unixVer": "3.9+"
335
- * },
336
- * "ios": {
337
- * "osVer": "12.0",
338
- * "uniVer": "",
339
- * "unixVer": "4.11"
340
- * },
341
- * "harmony": {
342
- * "osVer": "3.0",
343
- * "uniVer": "4.23",
344
- * "unixVer": "x"
345
- * }
346
- * },
347
- * "mp": {
348
- * "weixin": {
349
- * "hostVer": "",
350
- * "uniVer": "",
351
- * "unixVer": "4.41"
352
- * },
353
- * "alipay": {
354
- * "hostVer": "√",
355
- * "uniVer": "√",
356
- * "unixVer": "x"
357
- * },
358
- * "baidu": {
359
- * "hostVer": "√",
360
- * "uniVer": "√",
361
- * "unixVer": "x"
362
- * },
363
- * "toutiao": {
364
- * "hostVer": "√",
365
- * "uniVer": "√",
366
- * "unixVer": "x"
367
- * },
368
- * "lark": {
369
- * "hostVer": "√",
370
- * "uniVer": "√",
371
- * "unixVer": "x"
372
- * },
373
- * "qq": {
374
- * "hostVer": "√",
375
- * "uniVer": "√",
376
- * "unixVer": "x"
377
- * },
378
- * "kuaishou": {
379
- * "hostVer": "√",
380
- * "uniVer": "√",
381
- * "unixVer": "x"
382
- * },
383
- * "jd": {
384
- * "hostVer": "√",
385
- * "uniVer": "√",
386
- * "unixVer": "x"
387
- * }
388
- * },
389
- * "web": {
390
- * "uniVer": "√",
391
- * "unixVer": "4.0"
392
- * }
393
- * }
394
- * @example
395
- ```typescript
396
- uni.onSocketMessage(function (res) {
397
- console.log('收到服务器内容:' + res.data);
398
- });
399
- ```
343
+ sendSocketMessage(options: SendSocketMessageOptions): void;
344
+
345
+ /**
346
+ * 监听WebSocket接受到服务器的消息事件。
347
+ * @deprecated 已废弃,使用 SocketTask 的 onMessage 替换。
348
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketmessage
349
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketmessage
350
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketmessage
351
+ * @uniPlatform {
352
+ * "app": {
353
+ * "android": {
354
+ * "osVer": "4.4",
355
+ * "uniVer": "√",
356
+ * "uniUtsPlugin": "3.91",
357
+ * "unixVer": "3.91",
358
+ * "unixUtsPlugin": "3.91"
359
+ * },
360
+ * "ios": {
361
+ * "osVer": "12.0",
362
+ * "uniVer": "",
363
+ * "uniUtsPlugin": "4.11",
364
+ * "unixVer": "4.11",
365
+ * "unixUtsPlugin": "4.11"
366
+ * },
367
+ * "harmony": {
368
+ * "osVer": "3.0",
369
+ * "uniVer": "4.23",
370
+ * "unixVer": "x"
371
+ * }
372
+ * },
373
+ * "mp": {
374
+ * "weixin": {
375
+ * "hostVer": "√",
376
+ * "uniVer": "",
377
+ * "unixVer": "4.41"
378
+ * },
379
+ * "alipay": {
380
+ * "hostVer": "√",
381
+ * "uniVer": "",
382
+ * "unixVer": "x"
383
+ * },
384
+ * "baidu": {
385
+ * "hostVer": "√",
386
+ * "uniVer": "",
387
+ * "unixVer": "x"
388
+ * },
389
+ * "toutiao": {
390
+ * "hostVer": "√",
391
+ * "uniVer": "",
392
+ * "unixVer": "x"
393
+ * },
394
+ * "lark": {
395
+ * "hostVer": "√",
396
+ * "uniVer": "",
397
+ * "unixVer": "x"
398
+ * },
399
+ * "qq": {
400
+ * "hostVer": "√",
401
+ * "uniVer": "",
402
+ * "unixVer": "x"
403
+ * },
404
+ * "kuaishou": {
405
+ * "hostVer": "√",
406
+ * "uniVer": "",
407
+ * "unixVer": "x"
408
+ * },
409
+ * "jd": {
410
+ * "hostVer": "√",
411
+ * "uniVer": "",
412
+ * "unixVer": "x"
413
+ * }
414
+ * },
415
+ * "web": {
416
+ * "uniVer": "√",
417
+ * "unixVer": "4.0"
418
+ * }
419
+ * }
420
+ * @example
421
+ ```typescript
422
+ uni.onSocketMessage(function (res) {
423
+ console.log('收到服务器内容:' + res.data);
424
+ });
425
+ ```
400
426
  * @tutorial_weixin https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketMessage.html
401
427
  */
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
- * "app": {
410
- * "android": {
411
- * "osVer": "4.4",
412
- * "uniVer": "√",
413
- * "unixVer": "3.9+"
414
- * },
415
- * "ios": {
416
- * "osVer": "12.0",
417
- * "uniVer": "",
418
- * "unixVer": "4.11"
419
- * },
420
- * "harmony": {
421
- * "osVer": "3.0",
422
- * "uniVer": "4.23",
423
- * "unixVer": "x"
424
- * }
425
- * },
426
- * "mp": {
427
- * "weixin": {
428
- * "hostVer": "",
429
- * "uniVer": "",
430
- * "unixVer": "4.41"
431
- * },
432
- * "alipay": {
433
- * "hostVer": "√",
434
- * "uniVer": "√",
435
- * "unixVer": "x"
436
- * },
437
- * "baidu": {
438
- * "hostVer": "√",
439
- * "uniVer": "√",
440
- * "unixVer": "x"
441
- * },
442
- * "toutiao": {
443
- * "hostVer": "√",
444
- * "uniVer": "√",
445
- * "unixVer": "x"
446
- * },
447
- * "lark": {
448
- * "hostVer": "√",
449
- * "uniVer": "√",
450
- * "unixVer": "x"
451
- * },
452
- * "qq": {
453
- * "hostVer": "√",
454
- * "uniVer": "√",
455
- * "unixVer": "x"
456
- * },
457
- * "kuaishou": {
458
- * "hostVer": "√",
459
- * "uniVer": "√",
460
- * "unixVer": "x"
461
- * },
462
- * "jd": {
463
- * "hostVer": "√",
464
- * "uniVer": "√",
465
- * "unixVer": "x"
466
- * }
467
- * },
468
- * "web": {
469
- * "uniVer": "√",
470
- * "unixVer": "4.0"
471
- * }
472
- * }
473
- * @example
474
- ```typescript
475
- uni.closeSocket();
476
- ```
428
+ onSocketMessage(callback: OnSocketMessageCallback): void;
429
+
430
+ /**
431
+ * 关闭 WebSocket 连接。
432
+ * @deprecated 已废弃,使用 SocketTask 的 close 替换。
433
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#closesocket
434
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#closesocket
435
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#closesocket
436
+ * @uniPlatform {
437
+ * "app": {
438
+ * "android": {
439
+ * "osVer": "4.4",
440
+ * "uniVer": "√",
441
+ * "uniUtsPlugin": "3.91",
442
+ * "unixVer": "3.91",
443
+ * "unixUtsPlugin": "3.91"
444
+ * },
445
+ * "ios": {
446
+ * "osVer": "12.0",
447
+ * "uniVer": "",
448
+ * "uniUtsPlugin": "4.11",
449
+ * "unixVer": "4.11",
450
+ * "unixUtsPlugin": "4.11"
451
+ * },
452
+ * "harmony": {
453
+ * "osVer": "3.0",
454
+ * "uniVer": "4.23",
455
+ * "unixVer": "x"
456
+ * }
457
+ * },
458
+ * "mp": {
459
+ * "weixin": {
460
+ * "hostVer": "√",
461
+ * "uniVer": "",
462
+ * "unixVer": "4.41"
463
+ * },
464
+ * "alipay": {
465
+ * "hostVer": "√",
466
+ * "uniVer": "",
467
+ * "unixVer": "x"
468
+ * },
469
+ * "baidu": {
470
+ * "hostVer": "√",
471
+ * "uniVer": "",
472
+ * "unixVer": "x"
473
+ * },
474
+ * "toutiao": {
475
+ * "hostVer": "√",
476
+ * "uniVer": "",
477
+ * "unixVer": "x"
478
+ * },
479
+ * "lark": {
480
+ * "hostVer": "√",
481
+ * "uniVer": "",
482
+ * "unixVer": "x"
483
+ * },
484
+ * "qq": {
485
+ * "hostVer": "√",
486
+ * "uniVer": "",
487
+ * "unixVer": "x"
488
+ * },
489
+ * "kuaishou": {
490
+ * "hostVer": "√",
491
+ * "uniVer": "",
492
+ * "unixVer": "x"
493
+ * },
494
+ * "jd": {
495
+ * "hostVer": "√",
496
+ * "uniVer": "",
497
+ * "unixVer": "x"
498
+ * }
499
+ * },
500
+ * "web": {
501
+ * "uniVer": "√",
502
+ * "unixVer": "4.0"
503
+ * }
504
+ * }
505
+ * @example
506
+ ```typescript
507
+ uni.closeSocket();
508
+ ```
477
509
  * @tutorial_weixin https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.closeSocket.html
478
510
  */
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
- * "app": {
487
- * "android": {
488
- * "osVer": "4.4",
489
- * "uniVer": "√",
490
- * "unixVer": "3.9+"
491
- * },
492
- * "ios": {
493
- * "osVer": "12.0",
494
- * "uniVer": "",
495
- * "unixVer": "4.11"
496
- * },
497
- * "harmony": {
498
- * "osVer": "3.0",
499
- * "uniVer": "4.23",
500
- * "unixVer": "x"
501
- * }
502
- * },
503
- * "mp": {
504
- * "weixin": {
505
- * "hostVer": "",
506
- * "uniVer": "",
507
- * "unixVer": "4.41"
508
- * },
509
- * "alipay": {
510
- * "hostVer": "√",
511
- * "uniVer": "√",
512
- * "unixVer": "x"
513
- * },
514
- * "baidu": {
515
- * "hostVer": "√",
516
- * "uniVer": "√",
517
- * "unixVer": "x"
518
- * },
519
- * "toutiao": {
520
- * "hostVer": "√",
521
- * "uniVer": "√",
522
- * "unixVer": "x"
523
- * },
524
- * "lark": {
525
- * "hostVer": "√",
526
- * "uniVer": "√",
527
- * "unixVer": "x"
528
- * },
529
- * "qq": {
530
- * "hostVer": "√",
531
- * "uniVer": "√",
532
- * "unixVer": "x"
533
- * },
534
- * "kuaishou": {
535
- * "hostVer": "√",
536
- * "uniVer": "√",
537
- * "unixVer": "x"
538
- * },
539
- * "jd": {
540
- * "hostVer": "√",
541
- * "uniVer": "√",
542
- * "unixVer": "x"
543
- * }
544
- * },
545
- * "web": {
546
- * "uniVer": "√",
547
- * "unixVer": "4.0"
548
- * }
549
- * }
550
- * @example
551
- ```typescript
552
- uni.onSocketClose(function (res) {
553
- console.log('WebSocket 已关闭!');
554
- });
555
- ```
511
+ closeSocket(options: CloseSocketOptions): void;
512
+
513
+ /**
514
+ * 监听WebSocket关闭。
515
+ * @deprecated 已废弃,使用 SocketTask 的 onClose 替换。
516
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketclose
517
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketclose
518
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onsocketclose
519
+ * @uniPlatform {
520
+ * "app": {
521
+ * "android": {
522
+ * "osVer": "4.4",
523
+ * "uniVer": "√",
524
+ * "uniUtsPlugin": "3.91",
525
+ * "unixVer": "3.91",
526
+ * "unixUtsPlugin": "3.91"
527
+ * },
528
+ * "ios": {
529
+ * "osVer": "12.0",
530
+ * "uniVer": "",
531
+ * "uniUtsPlugin": "4.11",
532
+ * "unixVer": "4.11",
533
+ * "unixUtsPlugin": "4.11"
534
+ * },
535
+ * "harmony": {
536
+ * "osVer": "3.0",
537
+ * "uniVer": "4.23",
538
+ * "unixVer": "x"
539
+ * }
540
+ * },
541
+ * "mp": {
542
+ * "weixin": {
543
+ * "hostVer": "√",
544
+ * "uniVer": "",
545
+ * "unixVer": "4.41"
546
+ * },
547
+ * "alipay": {
548
+ * "hostVer": "√",
549
+ * "uniVer": "",
550
+ * "unixVer": "x"
551
+ * },
552
+ * "baidu": {
553
+ * "hostVer": "√",
554
+ * "uniVer": "",
555
+ * "unixVer": "x"
556
+ * },
557
+ * "toutiao": {
558
+ * "hostVer": "√",
559
+ * "uniVer": "",
560
+ * "unixVer": "x"
561
+ * },
562
+ * "lark": {
563
+ * "hostVer": "√",
564
+ * "uniVer": "",
565
+ * "unixVer": "x"
566
+ * },
567
+ * "qq": {
568
+ * "hostVer": "√",
569
+ * "uniVer": "",
570
+ * "unixVer": "x"
571
+ * },
572
+ * "kuaishou": {
573
+ * "hostVer": "√",
574
+ * "uniVer": "",
575
+ * "unixVer": "x"
576
+ * },
577
+ * "jd": {
578
+ * "hostVer": "√",
579
+ * "uniVer": "",
580
+ * "unixVer": "x"
581
+ * }
582
+ * },
583
+ * "web": {
584
+ * "uniVer": "√",
585
+ * "unixVer": "4.0"
586
+ * }
587
+ * }
588
+ * @example
589
+ ```typescript
590
+ uni.onSocketClose(function (res) {
591
+ console.log('WebSocket 已关闭!');
592
+ });
593
+ ```
556
594
  * @tutorial_weixin https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketClose.html
557
595
  */
558
- onSocketClose(callback: OnSocketCloseCallback): void;
596
+ onSocketClose(callback: OnSocketCloseCallback): void;
559
597
  }
560
598
 
561
599
  export type ConnectSocket = (options: ConnectSocketOptions) => SocketTask;
@@ -624,348 +662,360 @@ type ConnectSocketFailCallback = (result: ConnectSocketFail) => void;
624
662
  type ConnectSocketComplete = any;
625
663
  type ConnectSocketCompleteCallback = (result: ConnectSocketComplete) => void;
626
664
  export type ConnectSocketOptions = {
627
- /**
628
- * 开发者服务器接口地址
629
- * @uniPlatform
630
- * {
631
- * "app": {
632
- * "android": {
633
- * "osVer": "5.0",
634
- * "uniVer": "√",
635
- * "unixVer": "3.9+"
636
- * },
637
- * "ios": {
638
- * "osVer": "12.0",
639
- * "uniVer": "√",
640
- * "unixVer": "4.11"
641
- * },
642
- * "harmony": {
643
- * "osVer": "3.0",
644
- * "uniVer": "4.23",
645
- * "unixVer": "x"
646
- * }
647
- * },
648
- * "mp": {
649
- * "weixin": {
650
- * "hostVer": "√",
651
- * "uniVer": "√",
652
- * "unixVer": "4.41"
653
- * },
654
- * "alipay": {
655
- * "hostVer": "√",
656
- * "uniVer": "",
657
- * "unixVer": "x"
658
- * },
659
- * "baidu": {
660
- * "hostVer": "√",
661
- * "uniVer": "",
662
- * "unixVer": "x"
663
- * },
664
- * "toutiao": {
665
- * "hostVer": "√",
666
- * "uniVer": "",
667
- * "unixVer": "x"
668
- * },
669
- * "lark": {
670
- * "hostVer": "√",
671
- * "uniVer": "",
672
- * "unixVer": "x"
673
- * },
674
- * "qq": {
675
- * "hostVer": "√",
676
- * "uniVer": "",
677
- * "unixVer": "x"
678
- * },
679
- * "kuaishou": {
680
- * "hostVer": "√",
681
- * "uniVer": "",
682
- * "unixVer": "x"
683
- * },
684
- * "jd": {
685
- * "hostVer": "√",
686
- * "uniVer": "",
687
- * "unixVer": "x"
688
- * }
689
- * }
690
- * }
691
- */
692
- url: string,
693
- /**
694
- * HTTP 请求 Header,header 中不能设置 Referer
695
- * @defaultValue null
696
- * @uniPlatform
697
- * {
698
- * "app": {
699
- * "android": {
700
- * "osVer": "5.0",
701
- * "uniVer": "√",
702
- * "unixVer": "3.9+"
703
- * },
704
- * "ios": {
705
- * "osVer": "12.0",
706
- * "uniVer": "√",
707
- * "unixVer": "4.11"
708
- * },
709
- * "harmony": {
710
- * "osVer": "3.0",
711
- * "uniVer": "4.23",
712
- * "unixVer": "x"
713
- * }
714
- * },
715
- * "mp": {
716
- * "weixin": {
717
- * "hostVer": "√",
718
- * "uniVer": "√",
719
- * "unixVer": "4.41"
720
- * },
721
- * "alipay": {
722
- * "hostVer": "√",
723
- * "uniVer": "",
724
- * "unixVer": "x"
725
- * },
726
- * "baidu": {
727
- * "hostVer": "√",
728
- * "uniVer": "",
729
- * "unixVer": "x"
730
- * },
731
- * "toutiao": {
732
- * "hostVer": "√",
733
- * "uniVer": "",
734
- * "unixVer": "x"
735
- * },
736
- * "lark": {
737
- * "hostVer": "√",
738
- * "uniVer": "",
739
- * "unixVer": "x"
740
- * },
741
- * "qq": {
742
- * "hostVer": "√",
743
- * "uniVer": "",
744
- * "unixVer": "x"
745
- * },
746
- * "kuaishou": {
747
- * "hostVer": "√",
748
- * "uniVer": "",
749
- * "unixVer": "x"
750
- * },
751
- * "jd": {
752
- * "hostVer": "√",
753
- * "uniVer": "",
754
- * "unixVer": "x"
755
- * }
756
- * }
757
- * }
758
- */
759
- header?: UTSJSONObject | null,
760
- /**
761
- * 子协议数组
762
- * @defaultValue null
763
- * @uniPlatform
764
- * {
765
- * "app": {
766
- * "android": {
767
- * "osVer": "5.0",
768
- * "uniVer": "√",
769
- * "unixVer": "3.9+"
770
- * },
771
- * "ios": {
772
- * "osVer": "12.0",
773
- * "uniVer": "√",
774
- * "unixVer": "4.11"
775
- * }
776
- * },
777
- * "mp": {
778
- * "weixin": {
779
- * "hostVer": "",
780
- * "uniVer": "√",
781
- * "unixVer": "4.41"
782
- * },
783
- * "alipay": {
784
- * "hostVer": "√",
785
- * "uniVer": "√",
786
- * "unixVer": "x"
787
- * },
788
- * "baidu": {
789
- * "hostVer": "√",
790
- * "uniVer": "",
791
- * "unixVer": "x"
792
- * },
793
- * "toutiao": {
794
- * "hostVer": "√",
795
- * "uniVer": "",
796
- * "unixVer": "x"
797
- * },
798
- * "lark": {
799
- * "hostVer": "√",
800
- * "uniVer": "",
801
- * "unixVer": "x"
802
- * },
803
- * "qq": {
804
- * "hostVer": "√",
805
- * "uniVer": "",
806
- * "unixVer": "x"
807
- * },
808
- * "kuaishou": {
809
- * "hostVer": "√",
810
- * "uniVer": "",
811
- * "unixVer": "x"
812
- * },
813
- * "jd": {
814
- * "hostVer": "√",
815
- * "uniVer": "",
816
- * "unixVer": "x"
817
- * }
818
- * }
819
- * }
820
- */
821
- protocols?: (string[]) | null,
822
- /**
823
- * 接口调用成功的回调函数
824
- * @defaultValue null
825
- * @uniPlatform {
826
- * "mp": {
827
- * "weixin": {
828
- * "hostVer": "√",
829
- * "uniVer": "√",
830
- * "unixVer": "4.41"
831
- * },
832
- * "alipay": {
833
- * "hostVer": "-",
834
- * "uniVer": "-",
835
- * "unixVer": "-"
836
- * },
837
- * "baidu": {
838
- * "hostVer": "-",
839
- * "uniVer": "-",
840
- * "unixVer": "-"
841
- * },
842
- * "toutiao": {
843
- * "hostVer": "-",
844
- * "uniVer": "-",
845
- * "unixVer": "-"
846
- * },
847
- * "lark": {
848
- * "hostVer": "-",
849
- * "uniVer": "-",
850
- * "unixVer": "-"
851
- * },
852
- * "qq": {
853
- * "hostVer": "-",
854
- * "uniVer": "-",
855
- * "unixVer": "-"
856
- * },
857
- * "kuaishou": {
858
- * "hostVer": "-",
859
- * "uniVer": "-",
860
- * "unixVer": "-"
861
- * },
862
- * "jd": {
863
- * "hostVer": "-",
864
- * "uniVer": "-",
865
- * "unixVer": "-"
866
- * }
867
- * }
868
- * }
869
- */
870
- success?: ConnectSocketSuccessCallback | null,
871
- /**
872
- * 接口调用失败的回调函数
873
- * @defaultValue null
874
- * @uniPlatform {
875
- * "mp": {
876
- * "weixin": {
877
- * "hostVer": "√",
878
- * "uniVer": "√",
879
- * "unixVer": "4.41"
880
- * },
881
- * "alipay": {
882
- * "hostVer": "-",
883
- * "uniVer": "-",
884
- * "unixVer": "-"
885
- * },
886
- * "baidu": {
887
- * "hostVer": "-",
888
- * "uniVer": "-",
889
- * "unixVer": "-"
890
- * },
891
- * "toutiao": {
892
- * "hostVer": "-",
893
- * "uniVer": "-",
894
- * "unixVer": "-"
895
- * },
896
- * "lark": {
897
- * "hostVer": "-",
898
- * "uniVer": "-",
899
- * "unixVer": "-"
900
- * },
901
- * "qq": {
902
- * "hostVer": "-",
903
- * "uniVer": "-",
904
- * "unixVer": "-"
905
- * },
906
- * "kuaishou": {
907
- * "hostVer": "-",
908
- * "uniVer": "-",
909
- * "unixVer": "-"
910
- * },
911
- * "jd": {
912
- * "hostVer": "-",
913
- * "uniVer": "-",
914
- * "unixVer": "-"
915
- * }
916
- * }
917
- * }
918
- */
919
- fail?: ConnectSocketFailCallback | null,
920
- /**
921
- * 接口调用结束的回调函数(调用成功、失败都会执行)
922
- * @defaultValue null
923
- * @uniPlatform {
924
- * "mp": {
925
- * "weixin": {
926
- * "hostVer": "√",
927
- * "uniVer": "√",
928
- * "unixVer": "4.41"
929
- * },
930
- * "alipay": {
931
- * "hostVer": "-",
932
- * "uniVer": "-",
933
- * "unixVer": "-"
934
- * },
935
- * "baidu": {
936
- * "hostVer": "-",
937
- * "uniVer": "-",
938
- * "unixVer": "-"
939
- * },
940
- * "toutiao": {
941
- * "hostVer": "-",
942
- * "uniVer": "-",
943
- * "unixVer": "-"
944
- * },
945
- * "lark": {
946
- * "hostVer": "-",
947
- * "uniVer": "-",
948
- * "unixVer": "-"
949
- * },
950
- * "qq": {
951
- * "hostVer": "-",
952
- * "uniVer": "-",
953
- * "unixVer": "-"
954
- * },
955
- * "kuaishou": {
956
- * "hostVer": "-",
957
- * "uniVer": "-",
958
- * "unixVer": "-"
959
- * },
960
- * "jd": {
961
- * "hostVer": "-",
962
- * "uniVer": "-",
963
- * "unixVer": "-"
964
- * }
965
- * }
966
- * }
967
- */
968
- complete?: ConnectSocketCompleteCallback | null
665
+ /**
666
+ * 开发者服务器接口地址
667
+ * @uniPlatform
668
+ {
669
+ "app": {
670
+ "android": {
671
+ "osVer": "4.4",
672
+ "uniVer": "√",
673
+ "uniUtsPlugin": "3.91",
674
+ "unixVer": "3.91",
675
+ "unixUtsPlugin": "3.91"
676
+ },
677
+ "ios": {
678
+ "osVer": "12.0",
679
+ "uniVer": "√",
680
+ "uniUtsPlugin": "4.11",
681
+ "unixVer": "4.11",
682
+ "unixUtsPlugin": "4.11"
683
+ },
684
+ "harmony": {
685
+ "osVer": "3.0",
686
+ "uniVer": "4.23",
687
+ "unixVer": "x"
688
+ }
689
+ },
690
+ "mp": {
691
+ "weixin": {
692
+ "hostVer": "√",
693
+ "uniVer": "√",
694
+ "unixVer": "4.41"
695
+ },
696
+ "alipay": {
697
+ "hostVer": "√",
698
+ "uniVer": "√",
699
+ "unixVer": "x"
700
+ },
701
+ "baidu": {
702
+ "hostVer": "√",
703
+ "uniVer": "√",
704
+ "unixVer": "x"
705
+ },
706
+ "toutiao": {
707
+ "hostVer": "√",
708
+ "uniVer": "√",
709
+ "unixVer": "x"
710
+ },
711
+ "lark": {
712
+ "hostVer": "√",
713
+ "uniVer": "√",
714
+ "unixVer": "x"
715
+ },
716
+ "qq": {
717
+ "hostVer": "√",
718
+ "uniVer": "√",
719
+ "unixVer": "x"
720
+ },
721
+ "kuaishou": {
722
+ "hostVer": "√",
723
+ "uniVer": "√",
724
+ "unixVer": "x"
725
+ },
726
+ "jd": {
727
+ "hostVer": "√",
728
+ "uniVer": "√",
729
+ "unixVer": "x"
730
+ }
731
+ }
732
+ }
733
+ */
734
+ url: string,
735
+
736
+ /**
737
+ * HTTP 请求 Header,header 中不能设置 Referer
738
+ * @defaultValue null
739
+ * @uniPlatform
740
+ {
741
+ "app": {
742
+ "android": {
743
+ "osVer": "4.4",
744
+ "uniVer": "√",
745
+ "uniUtsPlugin": "3.91",
746
+ "unixVer": "3.91",
747
+ "unixUtsPlugin": "3.91"
748
+ },
749
+ "ios": {
750
+ "osVer": "12.0",
751
+ "uniVer": "√",
752
+ "uniUtsPlugin": "4.11",
753
+ "unixVer": "4.11",
754
+ "unixUtsPlugin": "4.11"
755
+ }
756
+ },
757
+ "mp": {
758
+ "weixin": {
759
+ "hostVer": "√",
760
+ "uniVer": "√",
761
+ "unixVer": "4.41"
762
+ },
763
+ "alipay": {
764
+ "hostVer": "√",
765
+ "uniVer": "√",
766
+ "unixVer": "x"
767
+ },
768
+ "baidu": {
769
+ "hostVer": "√",
770
+ "uniVer": "√",
771
+ "unixVer": "x"
772
+ },
773
+ "toutiao": {
774
+ "hostVer": "√",
775
+ "uniVer": "√",
776
+ "unixVer": "x"
777
+ },
778
+ "lark": {
779
+ "hostVer": "√",
780
+ "uniVer": "√",
781
+ "unixVer": "x"
782
+ },
783
+ "qq": {
784
+ "hostVer": "√",
785
+ "uniVer": "√",
786
+ "unixVer": "x"
787
+ },
788
+ "kuaishou": {
789
+ "hostVer": "√",
790
+ "uniVer": "√",
791
+ "unixVer": "x"
792
+ },
793
+ "jd": {
794
+ "hostVer": "√",
795
+ "uniVer": "√",
796
+ "unixVer": "x"
797
+ }
798
+ }
799
+ }
800
+ */
801
+ header?: UTSJSONObject | null,
802
+
803
+ /**
804
+ * 子协议数组
805
+ * @defaultValue null
806
+ * @uniPlatform
807
+ {
808
+ "app": {
809
+ "android": {
810
+ "osVer": "4.4",
811
+ "uniVer": "√",
812
+ "uniUtsPlugin": "3.91",
813
+ "unixVer": "3.91",
814
+ "unixUtsPlugin": "3.91"
815
+ },
816
+ "ios": {
817
+ "osVer": "12.0",
818
+ "uniVer": "√",
819
+ "uniUtsPlugin": "4.11",
820
+ "unixVer": "4.11",
821
+ "unixUtsPlugin": "4.11"
822
+ }
823
+ },
824
+ "mp": {
825
+ "weixin": {
826
+ "hostVer": "√",
827
+ "uniVer": "√",
828
+ "unixVer": "4.41"
829
+ },
830
+ "alipay": {
831
+ "hostVer": "√",
832
+ "uniVer": "√",
833
+ "unixVer": "x"
834
+ },
835
+ "baidu": {
836
+ "hostVer": "√",
837
+ "uniVer": "√",
838
+ "unixVer": "x"
839
+ },
840
+ "toutiao": {
841
+ "hostVer": "√",
842
+ "uniVer": "√",
843
+ "unixVer": "x"
844
+ },
845
+ "lark": {
846
+ "hostVer": "√",
847
+ "uniVer": "√",
848
+ "unixVer": "x"
849
+ },
850
+ "qq": {
851
+ "hostVer": "√",
852
+ "uniVer": "√",
853
+ "unixVer": "x"
854
+ },
855
+ "kuaishou": {
856
+ "hostVer": "√",
857
+ "uniVer": "√",
858
+ "unixVer": "x"
859
+ },
860
+ "jd": {
861
+ "hostVer": "√",
862
+ "uniVer": "√",
863
+ "unixVer": "x"
864
+ }
865
+ }
866
+ }
867
+ */
868
+ protocols?: (string[]) | null,
869
+
870
+ /**
871
+ * 接口调用成功的回调函数
872
+ * @defaultValue null
873
+ * @uniPlatform {
874
+ * "mp": {
875
+ * "weixin": {
876
+ * "hostVer": "",
877
+ * "uniVer": "",
878
+ * "unixVer": "4.41"
879
+ * },
880
+ * "alipay": {
881
+ * "hostVer": "-",
882
+ * "uniVer": "-",
883
+ * "unixVer": "-"
884
+ * },
885
+ * "baidu": {
886
+ * "hostVer": "-",
887
+ * "uniVer": "-",
888
+ * "unixVer": "-"
889
+ * },
890
+ * "toutiao": {
891
+ * "hostVer": "-",
892
+ * "uniVer": "-",
893
+ * "unixVer": "-"
894
+ * },
895
+ * "lark": {
896
+ * "hostVer": "-",
897
+ * "uniVer": "-",
898
+ * "unixVer": "-"
899
+ * },
900
+ * "qq": {
901
+ * "hostVer": "-",
902
+ * "uniVer": "-",
903
+ * "unixVer": "-"
904
+ * },
905
+ * "kuaishou": {
906
+ * "hostVer": "-",
907
+ * "uniVer": "-",
908
+ * "unixVer": "-"
909
+ * },
910
+ * "jd": {
911
+ * "hostVer": "-",
912
+ * "uniVer": "-",
913
+ * "unixVer": "-"
914
+ * }
915
+ * }
916
+ * }
917
+ */
918
+ success?: ConnectSocketSuccessCallback | null,
919
+
920
+ /**
921
+ * 接口调用失败的回调函数
922
+ * @defaultValue null
923
+ * @uniPlatform {
924
+ * "mp": {
925
+ * "weixin": {
926
+ * "hostVer": "",
927
+ * "uniVer": "",
928
+ * "unixVer": "4.41"
929
+ * },
930
+ * "alipay": {
931
+ * "hostVer": "-",
932
+ * "uniVer": "-",
933
+ * "unixVer": "-"
934
+ * },
935
+ * "baidu": {
936
+ * "hostVer": "-",
937
+ * "uniVer": "-",
938
+ * "unixVer": "-"
939
+ * },
940
+ * "toutiao": {
941
+ * "hostVer": "-",
942
+ * "uniVer": "-",
943
+ * "unixVer": "-"
944
+ * },
945
+ * "lark": {
946
+ * "hostVer": "-",
947
+ * "uniVer": "-",
948
+ * "unixVer": "-"
949
+ * },
950
+ * "qq": {
951
+ * "hostVer": "-",
952
+ * "uniVer": "-",
953
+ * "unixVer": "-"
954
+ * },
955
+ * "kuaishou": {
956
+ * "hostVer": "-",
957
+ * "uniVer": "-",
958
+ * "unixVer": "-"
959
+ * },
960
+ * "jd": {
961
+ * "hostVer": "-",
962
+ * "uniVer": "-",
963
+ * "unixVer": "-"
964
+ * }
965
+ * }
966
+ * }
967
+ */
968
+ fail?: ConnectSocketFailCallback | null,
969
+
970
+ /**
971
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
972
+ * @defaultValue null
973
+ * @uniPlatform {
974
+ * "mp": {
975
+ * "weixin": {
976
+ * "hostVer": "",
977
+ * "uniVer": "√",
978
+ * "unixVer": "4.41"
979
+ * },
980
+ * "alipay": {
981
+ * "hostVer": "-",
982
+ * "uniVer": "-",
983
+ * "unixVer": "-"
984
+ * },
985
+ * "baidu": {
986
+ * "hostVer": "-",
987
+ * "uniVer": "-",
988
+ * "unixVer": "-"
989
+ * },
990
+ * "toutiao": {
991
+ * "hostVer": "-",
992
+ * "uniVer": "-",
993
+ * "unixVer": "-"
994
+ * },
995
+ * "lark": {
996
+ * "hostVer": "-",
997
+ * "uniVer": "-",
998
+ * "unixVer": "-"
999
+ * },
1000
+ * "qq": {
1001
+ * "hostVer": "-",
1002
+ * "uniVer": "-",
1003
+ * "unixVer": "-"
1004
+ * },
1005
+ * "kuaishou": {
1006
+ * "hostVer": "-",
1007
+ * "uniVer": "-",
1008
+ * "unixVer": "-"
1009
+ * },
1010
+ * "jd": {
1011
+ * "hostVer": "-",
1012
+ * "uniVer": "-",
1013
+ * "unixVer": "-"
1014
+ * }
1015
+ * }
1016
+ * }
1017
+ */
1018
+ complete?: ConnectSocketCompleteCallback | null
969
1019
  /**
970
1020
  * 需要基础库: `2.29.0`
971
1021
  *
@@ -1171,6 +1221,7 @@ export type ConnectSocketOptions = {
1171
1221
  */
1172
1222
  timeout?: number | null;
1173
1223
  };
1224
+
1174
1225
  export type GeneralCallbackResult = {
1175
1226
  /**
1176
1227
  * 错误信息
@@ -1221,6 +1272,7 @@ export type GeneralCallbackResult = {
1221
1272
  */
1222
1273
  errMsg: string
1223
1274
  };
1275
+
1224
1276
  /**
1225
1277
  * 错误码
1226
1278
  */
@@ -1289,175 +1341,82 @@ export interface SendSocketMessageFail extends IUniError {
1289
1341
  errCode: SendSocketMessageErrorCode;
1290
1342
  };
1291
1343
  export type SendSocketMessageOptions = {
1292
- /**
1293
- * 需要发送的内容
1294
- * @type string | ArrayBuffer
1295
- * @type {SocketDataOptions}
1296
- * @uniPlatform
1297
- * {
1298
- * "app": {
1299
- * "android": {
1300
- * "osVer": "5.0",
1301
- * "uniVer": "√",
1302
- * "unixVer": "3.9+"
1303
- * },
1304
- * "ios": {
1305
- * "osVer": "12.0",
1306
- * "uniVer": "√",
1307
- * "unixVer": "4.11"
1308
- * },
1309
- * "harmony": {
1310
- * "osVer": "3.0",
1311
- * "uniVer": "4.23",
1312
- * "unixVer": "x"
1313
- * }
1314
- * },
1315
- * "mp": {
1316
- * "weixin": {
1317
- * "hostVer": "√",
1318
- * "uniVer": "√",
1319
- * "unixVer": "4.41"
1320
- * },
1321
- * "alipay": {
1322
- * "hostVer": "√",
1323
- * "uniVer": "",
1324
- * "unixVer": "x"
1325
- * },
1326
- * "baidu": {
1327
- * "hostVer": "√",
1328
- * "uniVer": "",
1329
- * "unixVer": "x"
1330
- * },
1331
- * "toutiao": {
1332
- * "hostVer": "√",
1333
- * "uniVer": "",
1334
- * "unixVer": "x"
1335
- * },
1336
- * "lark": {
1337
- * "hostVer": "√",
1338
- * "uniVer": "",
1339
- * "unixVer": "x"
1340
- * },
1341
- * "qq": {
1342
- * "hostVer": "√",
1343
- * "uniVer": "",
1344
- * "unixVer": "x"
1345
- * },
1346
- * "kuaishou": {
1347
- * "hostVer": "√",
1348
- * "uniVer": "",
1349
- * "unixVer": "x"
1350
- * },
1351
- * "jd": {
1352
- * "hostVer": "√",
1353
- * "uniVer": "",
1354
- * "unixVer": "x"
1355
- * }
1356
- * }
1357
- * }
1358
- */
1359
- data: any,
1360
- /**
1361
- * 接口调用成功的回调函数
1362
- * @defaultValue null
1363
- * @uniPlatform {
1364
- * "mp": {
1365
- * "weixin": {
1366
- * "hostVer": "√",
1367
- * "uniVer": "√",
1368
- * "unixVer": "4.41"
1369
- * },
1370
- * "alipay": {
1371
- * "hostVer": "-",
1372
- * "uniVer": "-",
1373
- * "unixVer": "-"
1374
- * },
1375
- * "baidu": {
1376
- * "hostVer": "-",
1377
- * "uniVer": "-",
1378
- * "unixVer": "-"
1379
- * },
1380
- * "toutiao": {
1381
- * "hostVer": "-",
1382
- * "uniVer": "-",
1383
- * "unixVer": "-"
1384
- * },
1385
- * "lark": {
1386
- * "hostVer": "-",
1387
- * "uniVer": "-",
1388
- * "unixVer": "-"
1389
- * },
1390
- * "qq": {
1391
- * "hostVer": "-",
1392
- * "uniVer": "-",
1393
- * "unixVer": "-"
1394
- * },
1395
- * "kuaishou": {
1396
- * "hostVer": "-",
1397
- * "uniVer": "-",
1398
- * "unixVer": "-"
1399
- * },
1400
- * "jd": {
1401
- * "hostVer": "-",
1402
- * "uniVer": "-",
1403
- * "unixVer": "-"
1404
- * }
1405
- * }
1406
- * }
1407
- */
1408
- success?: ((result: GeneralCallbackResult) => void) | null,
1409
- /**
1410
- * 接口调用失败的回调函数
1411
- * @defaultValue null
1412
- * @uniPlatform {
1413
- * "mp": {
1414
- * "weixin": {
1415
- * "hostVer": "√",
1416
- * "uniVer": "√",
1417
- * "unixVer": "4.41"
1418
- * },
1419
- * "alipay": {
1420
- * "hostVer": "-",
1421
- * "uniVer": "-",
1422
- * "unixVer": "-"
1423
- * },
1424
- * "baidu": {
1425
- * "hostVer": "-",
1426
- * "uniVer": "-",
1427
- * "unixVer": "-"
1428
- * },
1429
- * "toutiao": {
1430
- * "hostVer": "-",
1431
- * "uniVer": "-",
1432
- * "unixVer": "-"
1433
- * },
1434
- * "lark": {
1435
- * "hostVer": "-",
1436
- * "uniVer": "-",
1437
- * "unixVer": "-"
1438
- * },
1439
- * "qq": {
1440
- * "hostVer": "-",
1441
- * "uniVer": "-",
1442
- * "unixVer": "-"
1443
- * },
1444
- * "kuaishou": {
1445
- * "hostVer": "-",
1446
- * "uniVer": "-",
1447
- * "unixVer": "-"
1448
- * },
1449
- * "jd": {
1450
- * "hostVer": "-",
1451
- * "uniVer": "-",
1452
- * "unixVer": "-"
1453
- * }
1454
- * }
1455
- * }
1456
- */
1457
- fail?: ((result: SendSocketMessageFail) => void) | null,
1458
- /**
1459
- * 接口调用结束的回调函数(调用成功、失败都会执行)
1460
- * @defaultValue null
1344
+ /**
1345
+ * 需要发送的内容
1346
+ * @type string | ArrayBuffer
1347
+ * @type {SocketDataOptions}
1348
+ * @uniPlatform
1349
+ {
1350
+ "app": {
1351
+ "android": {
1352
+ "osVer": "4.4",
1353
+ "uniVer": "√",
1354
+ "uniUtsPlugin": "3.91",
1355
+ "unixVer": "3.91",
1356
+ "unixUtsPlugin": "3.91"
1357
+ },
1358
+ "ios": {
1359
+ "osVer": "12.0",
1360
+ "uniVer": "√",
1361
+ "uniUtsPlugin": "4.11",
1362
+ "unixVer": "4.11",
1363
+ "unixUtsPlugin": "4.11"
1364
+ },
1365
+ "harmony": {
1366
+ "osVer": "3.0",
1367
+ "uniVer": "4.23",
1368
+ "unixVer": "x"
1369
+ }
1370
+ },
1371
+ "mp": {
1372
+ "weixin": {
1373
+ "hostVer": "√",
1374
+ "uniVer": "√",
1375
+ "unixVer": "4.41"
1376
+ },
1377
+ "alipay": {
1378
+ "hostVer": "√",
1379
+ "uniVer": "√",
1380
+ "unixVer": "x"
1381
+ },
1382
+ "baidu": {
1383
+ "hostVer": "√",
1384
+ "uniVer": "√",
1385
+ "unixVer": "x"
1386
+ },
1387
+ "toutiao": {
1388
+ "hostVer": "√",
1389
+ "uniVer": "√",
1390
+ "unixVer": "x"
1391
+ },
1392
+ "lark": {
1393
+ "hostVer": "√",
1394
+ "uniVer": "√",
1395
+ "unixVer": "x"
1396
+ },
1397
+ "qq": {
1398
+ "hostVer": "√",
1399
+ "uniVer": "√",
1400
+ "unixVer": "x"
1401
+ },
1402
+ "kuaishou": {
1403
+ "hostVer": "√",
1404
+ "uniVer": "√",
1405
+ "unixVer": "x"
1406
+ },
1407
+ "jd": {
1408
+ "hostVer": "√",
1409
+ "uniVer": "√",
1410
+ "unixVer": "x"
1411
+ }
1412
+ }
1413
+ }
1414
+ */
1415
+ data: any,
1416
+
1417
+ /**
1418
+ * 接口调用成功的回调函数
1419
+ * @defaultValue null
1461
1420
  * @uniPlatform {
1462
1421
  * "mp": {
1463
1422
  * "weixin": {
@@ -1503,896 +1462,1049 @@ export type SendSocketMessageOptions = {
1503
1462
  * }
1504
1463
  * }
1505
1464
  */
1506
- complete?: ((result: any) => void) | null
1465
+ success?: ((result: GeneralCallbackResult) => void) | null,
1466
+
1467
+ /**
1468
+ * 接口调用失败的回调函数
1469
+ * @defaultValue null
1470
+ * @uniPlatform {
1471
+ * "mp": {
1472
+ * "weixin": {
1473
+ * "hostVer": "√",
1474
+ * "uniVer": "√",
1475
+ * "unixVer": "4.41"
1476
+ * },
1477
+ * "alipay": {
1478
+ * "hostVer": "-",
1479
+ * "uniVer": "-",
1480
+ * "unixVer": "-"
1481
+ * },
1482
+ * "baidu": {
1483
+ * "hostVer": "-",
1484
+ * "uniVer": "-",
1485
+ * "unixVer": "-"
1486
+ * },
1487
+ * "toutiao": {
1488
+ * "hostVer": "-",
1489
+ * "uniVer": "-",
1490
+ * "unixVer": "-"
1491
+ * },
1492
+ * "lark": {
1493
+ * "hostVer": "-",
1494
+ * "uniVer": "-",
1495
+ * "unixVer": "-"
1496
+ * },
1497
+ * "qq": {
1498
+ * "hostVer": "-",
1499
+ * "uniVer": "-",
1500
+ * "unixVer": "-"
1501
+ * },
1502
+ * "kuaishou": {
1503
+ * "hostVer": "-",
1504
+ * "uniVer": "-",
1505
+ * "unixVer": "-"
1506
+ * },
1507
+ * "jd": {
1508
+ * "hostVer": "-",
1509
+ * "uniVer": "-",
1510
+ * "unixVer": "-"
1511
+ * }
1512
+ * }
1513
+ * }
1514
+ */
1515
+ fail?: ((result: SendSocketMessageFail) => void) | null,
1516
+
1517
+ /**
1518
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
1519
+ * @defaultValue null
1520
+ * @uniPlatform {
1521
+ * "mp": {
1522
+ * "weixin": {
1523
+ * "hostVer": "√",
1524
+ * "uniVer": "√",
1525
+ * "unixVer": "4.41"
1526
+ * },
1527
+ * "alipay": {
1528
+ * "hostVer": "-",
1529
+ * "uniVer": "-",
1530
+ * "unixVer": "-"
1531
+ * },
1532
+ * "baidu": {
1533
+ * "hostVer": "-",
1534
+ * "uniVer": "-",
1535
+ * "unixVer": "-"
1536
+ * },
1537
+ * "toutiao": {
1538
+ * "hostVer": "-",
1539
+ * "uniVer": "-",
1540
+ * "unixVer": "-"
1541
+ * },
1542
+ * "lark": {
1543
+ * "hostVer": "-",
1544
+ * "uniVer": "-",
1545
+ * "unixVer": "-"
1546
+ * },
1547
+ * "qq": {
1548
+ * "hostVer": "-",
1549
+ * "uniVer": "-",
1550
+ * "unixVer": "-"
1551
+ * },
1552
+ * "kuaishou": {
1553
+ * "hostVer": "-",
1554
+ * "uniVer": "-",
1555
+ * "unixVer": "-"
1556
+ * },
1557
+ * "jd": {
1558
+ * "hostVer": "-",
1559
+ * "uniVer": "-",
1560
+ * "unixVer": "-"
1561
+ * }
1562
+ * }
1563
+ * }
1564
+ */
1565
+ complete?: ((result: any) => void) | null
1507
1566
  };
1567
+
1508
1568
  export type CloseSocketOptions = {
1509
- /**
1510
- * 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。如果这个参数没有被指定,默认的取值是1000 (表示正常连接关闭)
1511
- * @defaultValue 1000
1512
- * @uniPlatform
1513
- * {
1514
- * "app": {
1515
- * "android": {
1516
- * "osVer": "5.0",
1517
- * "uniVer": "√",
1518
- * "unixVer": "3.9+"
1519
- * },
1520
- * "ios": {
1521
- * "osVer": "12.0",
1522
- * "uniVer": "√",
1523
- * "unixVer": "4.11"
1524
- * },
1525
- * "harmony": {
1526
- * "osVer": "3.0",
1527
- * "uniVer": "4.23",
1528
- * "unixVer": "x"
1529
- * }
1530
- * },
1531
- * "mp": {
1532
- * "weixin": {
1533
- * "hostVer": "√",
1534
- * "uniVer": "√",
1535
- * "unixVer": "4.41"
1536
- * },
1537
- * "alipay": {
1538
- * "hostVer": "√",
1539
- * "uniVer": "",
1540
- * "unixVer": "x"
1541
- * },
1542
- * "baidu": {
1543
- * "hostVer": "√",
1544
- * "uniVer": "",
1545
- * "unixVer": "x"
1546
- * },
1547
- * "toutiao": {
1548
- * "hostVer": "√",
1549
- * "uniVer": "",
1550
- * "unixVer": "x"
1551
- * },
1552
- * "lark": {
1553
- * "hostVer": "√",
1554
- * "uniVer": "",
1555
- * "unixVer": "x"
1556
- * },
1557
- * "qq": {
1558
- * "hostVer": "√",
1559
- * "uniVer": "",
1560
- * "unixVer": "x"
1561
- * },
1562
- * "kuaishou": {
1563
- * "hostVer": "√",
1564
- * "uniVer": "",
1565
- * "unixVer": "x"
1566
- * },
1567
- * "jd": {
1568
- * "hostVer": "√",
1569
- * "uniVer": "",
1570
- * "unixVer": "x"
1571
- * }
1572
- * }
1573
- * }
1574
- */
1575
- code?: number | null,
1576
- /**
1577
- * 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于123字节的UTF-8 文本(不是字符)
1578
- * @defaultValue ""
1579
- * @uniPlatform
1580
- * {
1581
- * "app": {
1582
- * "android": {
1583
- * "osVer": "5.0",
1584
- * "uniVer": "√",
1585
- * "unixVer": "3.9+"
1586
- * },
1587
- * "ios": {
1588
- * "osVer": "12.0",
1589
- * "uniVer": "√",
1590
- * "unixVer": "4.11"
1591
- * },
1592
- * "harmony": {
1593
- * "osVer": "3.0",
1594
- * "uniVer": "4.23",
1595
- * "unixVer": "x"
1596
- * }
1597
- * },
1598
- * "mp": {
1599
- * "weixin": {
1600
- * "hostVer": "√",
1601
- * "uniVer": "√",
1602
- * "unixVer": "4.41"
1603
- * },
1604
- * "alipay": {
1605
- * "hostVer": "√",
1606
- * "uniVer": "√",
1607
- * "unixVer": "x"
1608
- * },
1609
- * "baidu": {
1610
- * "hostVer": "√",
1611
- * "uniVer": "",
1612
- * "unixVer": "x"
1613
- * },
1614
- * "toutiao": {
1615
- * "hostVer": "√",
1616
- * "uniVer": "",
1617
- * "unixVer": "x"
1618
- * },
1619
- * "lark": {
1620
- * "hostVer": "√",
1621
- * "uniVer": "",
1622
- * "unixVer": "x"
1623
- * },
1624
- * "qq": {
1625
- * "hostVer": "√",
1626
- * "uniVer": "",
1627
- * "unixVer": "x"
1628
- * },
1629
- * "kuaishou": {
1630
- * "hostVer": "√",
1631
- * "uniVer": "",
1632
- * "unixVer": "x"
1633
- * },
1634
- * "jd": {
1635
- * "hostVer": "√",
1636
- * "uniVer": "",
1637
- * "unixVer": "x"
1638
- * }
1639
- * }
1640
- * }
1641
- */
1642
- reason?: string | null,
1643
- /**
1644
- * 接口调用成功的回调函数
1645
- * @defaultValue null
1646
- * @uniPlatform {
1647
- * "mp": {
1648
- * "weixin": {
1649
- * "hostVer": "√",
1650
- * "uniVer": "√",
1651
- * "unixVer": "4.41"
1652
- * },
1653
- * "alipay": {
1654
- * "hostVer": "-",
1655
- * "uniVer": "-",
1656
- * "unixVer": "-"
1657
- * },
1658
- * "baidu": {
1659
- * "hostVer": "-",
1660
- * "uniVer": "-",
1661
- * "unixVer": "-"
1662
- * },
1663
- * "toutiao": {
1664
- * "hostVer": "-",
1665
- * "uniVer": "-",
1666
- * "unixVer": "-"
1667
- * },
1668
- * "lark": {
1669
- * "hostVer": "-",
1670
- * "uniVer": "-",
1671
- * "unixVer": "-"
1672
- * },
1673
- * "qq": {
1674
- * "hostVer": "-",
1675
- * "uniVer": "-",
1676
- * "unixVer": "-"
1677
- * },
1678
- * "kuaishou": {
1679
- * "hostVer": "-",
1680
- * "uniVer": "-",
1681
- * "unixVer": "-"
1682
- * },
1683
- * "jd": {
1684
- * "hostVer": "-",
1685
- * "uniVer": "-",
1686
- * "unixVer": "-"
1687
- * }
1688
- * }
1689
- * }
1690
- */
1691
- success?: ((result: GeneralCallbackResult) => void) | null,
1692
- /**
1693
- * 接口调用失败的回调函数
1694
- * @defaultValue null
1695
- * @uniPlatform {
1696
- * "mp": {
1697
- * "weixin": {
1698
- * "hostVer": "√",
1699
- * "uniVer": "√",
1700
- * "unixVer": "4.41"
1701
- * },
1702
- * "alipay": {
1703
- * "hostVer": "-",
1704
- * "uniVer": "-",
1705
- * "unixVer": "-"
1706
- * },
1707
- * "baidu": {
1708
- * "hostVer": "-",
1709
- * "uniVer": "-",
1710
- * "unixVer": "-"
1711
- * },
1712
- * "toutiao": {
1713
- * "hostVer": "-",
1714
- * "uniVer": "-",
1715
- * "unixVer": "-"
1716
- * },
1717
- * "lark": {
1718
- * "hostVer": "-",
1719
- * "uniVer": "-",
1720
- * "unixVer": "-"
1721
- * },
1722
- * "qq": {
1723
- * "hostVer": "-",
1724
- * "uniVer": "-",
1725
- * "unixVer": "-"
1726
- * },
1727
- * "kuaishou": {
1728
- * "hostVer": "-",
1729
- * "uniVer": "-",
1730
- * "unixVer": "-"
1731
- * },
1732
- * "jd": {
1733
- * "hostVer": "-",
1734
- * "uniVer": "-",
1735
- * "unixVer": "-"
1736
- * }
1737
- * }
1738
- * }
1739
- */
1740
- fail?: ((result: GeneralCallbackResult) => void) | null,
1741
- /**
1742
- * 接口调用结束的回调函数(调用成功、失败都会执行)
1743
- * @defaultValue null
1744
- * @uniPlatform {
1745
- * "mp": {
1746
- * "weixin": {
1747
- * "hostVer": "√",
1748
- * "uniVer": "√",
1749
- * "unixVer": "4.41"
1750
- * },
1751
- * "alipay": {
1752
- * "hostVer": "-",
1753
- * "uniVer": "-",
1754
- * "unixVer": "-"
1755
- * },
1756
- * "baidu": {
1757
- * "hostVer": "-",
1758
- * "uniVer": "-",
1759
- * "unixVer": "-"
1760
- * },
1761
- * "toutiao": {
1762
- * "hostVer": "-",
1763
- * "uniVer": "-",
1764
- * "unixVer": "-"
1765
- * },
1766
- * "lark": {
1767
- * "hostVer": "-",
1768
- * "uniVer": "-",
1769
- * "unixVer": "-"
1770
- * },
1771
- * "qq": {
1772
- * "hostVer": "-",
1773
- * "uniVer": "-",
1774
- * "unixVer": "-"
1775
- * },
1776
- * "kuaishou": {
1777
- * "hostVer": "-",
1778
- * "uniVer": "-",
1779
- * "unixVer": "-"
1780
- * },
1781
- * "jd": {
1782
- * "hostVer": "-",
1783
- * "uniVer": "-",
1784
- * "unixVer": "-"
1785
- * }
1786
- * }
1787
- * }
1788
- */
1789
- complete?: ((result: GeneralCallbackResult) => void) | null
1569
+ /**
1570
+ * 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。如果这个参数没有被指定,默认的取值是1000 (表示正常连接关闭)
1571
+ * @defaultValue 1000
1572
+ * @uniPlatform
1573
+ {
1574
+ "app": {
1575
+ "android": {
1576
+ "osVer": "4.4",
1577
+ "uniVer": "√",
1578
+ "uniUtsPlugin": "3.91",
1579
+ "unixVer": "3.91",
1580
+ "unixUtsPlugin": "3.91"
1581
+ },
1582
+ "ios": {
1583
+ "osVer": "12.0",
1584
+ "uniVer": "√",
1585
+ "uniUtsPlugin": "4.11",
1586
+ "unixVer": "4.11",
1587
+ "unixUtsPlugin": "4.11"
1588
+ },
1589
+ "harmony": {
1590
+ "osVer": "3.0",
1591
+ "uniVer": "4.23",
1592
+ "unixVer": "x"
1593
+ }
1594
+ },
1595
+ "mp": {
1596
+ "weixin": {
1597
+ "hostVer": "√",
1598
+ "uniVer": "√",
1599
+ "unixVer": "4.41"
1600
+ },
1601
+ "alipay": {
1602
+ "hostVer": "√",
1603
+ "uniVer": "√",
1604
+ "unixVer": "x"
1605
+ },
1606
+ "baidu": {
1607
+ "hostVer": "√",
1608
+ "uniVer": "√",
1609
+ "unixVer": "x"
1610
+ },
1611
+ "toutiao": {
1612
+ "hostVer": "√",
1613
+ "uniVer": "√",
1614
+ "unixVer": "x"
1615
+ },
1616
+ "lark": {
1617
+ "hostVer": "√",
1618
+ "uniVer": "√",
1619
+ "unixVer": "x"
1620
+ },
1621
+ "qq": {
1622
+ "hostVer": "√",
1623
+ "uniVer": "√",
1624
+ "unixVer": "x"
1625
+ },
1626
+ "kuaishou": {
1627
+ "hostVer": "√",
1628
+ "uniVer": "√",
1629
+ "unixVer": "x"
1630
+ },
1631
+ "jd": {
1632
+ "hostVer": "√",
1633
+ "uniVer": "√",
1634
+ "unixVer": "x"
1635
+ }
1636
+ }
1637
+ }
1638
+ */
1639
+ code?: number | null,
1640
+
1641
+ /**
1642
+ * 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于123字节的UTF-8 文本(不是字符)
1643
+ * @defaultValue ""
1644
+ * @uniPlatform
1645
+ {
1646
+ "app": {
1647
+ "android": {
1648
+ "osVer": "4.4",
1649
+ "uniVer": "√",
1650
+ "uniUtsPlugin": "3.91",
1651
+ "unixVer": "3.91",
1652
+ "unixUtsPlugin": "3.91"
1653
+ },
1654
+ "ios": {
1655
+ "osVer": "12.0",
1656
+ "uniVer": "√",
1657
+ "uniUtsPlugin": "4.11",
1658
+ "unixVer": "4.11",
1659
+ "unixUtsPlugin": "4.11"
1660
+ },
1661
+ "harmony": {
1662
+ "osVer": "3.0",
1663
+ "uniVer": "4.23",
1664
+ "unixVer": "x"
1665
+ }
1666
+ },
1667
+ "mp": {
1668
+ "weixin": {
1669
+ "hostVer": "√",
1670
+ "uniVer": "√",
1671
+ "unixVer": "4.41"
1672
+ },
1673
+ "alipay": {
1674
+ "hostVer": "√",
1675
+ "uniVer": "√",
1676
+ "unixVer": "x"
1677
+ },
1678
+ "baidu": {
1679
+ "hostVer": "√",
1680
+ "uniVer": "√",
1681
+ "unixVer": "x"
1682
+ },
1683
+ "toutiao": {
1684
+ "hostVer": "√",
1685
+ "uniVer": "√",
1686
+ "unixVer": "x"
1687
+ },
1688
+ "lark": {
1689
+ "hostVer": "√",
1690
+ "uniVer": "√",
1691
+ "unixVer": "x"
1692
+ },
1693
+ "qq": {
1694
+ "hostVer": "√",
1695
+ "uniVer": "√",
1696
+ "unixVer": "x"
1697
+ },
1698
+ "kuaishou": {
1699
+ "hostVer": "√",
1700
+ "uniVer": "√",
1701
+ "unixVer": "x"
1702
+ },
1703
+ "jd": {
1704
+ "hostVer": "√",
1705
+ "uniVer": "√",
1706
+ "unixVer": "x"
1707
+ }
1708
+ }
1709
+ }
1710
+ */
1711
+ reason?: string | null,
1712
+
1713
+ /**
1714
+ * 接口调用成功的回调函数
1715
+ * @defaultValue null
1716
+ * @uniPlatform {
1717
+ * "mp": {
1718
+ * "weixin": {
1719
+ * "hostVer": "",
1720
+ * "uniVer": "",
1721
+ * "unixVer": "4.41"
1722
+ * },
1723
+ * "alipay": {
1724
+ * "hostVer": "-",
1725
+ * "uniVer": "-",
1726
+ * "unixVer": "-"
1727
+ * },
1728
+ * "baidu": {
1729
+ * "hostVer": "-",
1730
+ * "uniVer": "-",
1731
+ * "unixVer": "-"
1732
+ * },
1733
+ * "toutiao": {
1734
+ * "hostVer": "-",
1735
+ * "uniVer": "-",
1736
+ * "unixVer": "-"
1737
+ * },
1738
+ * "lark": {
1739
+ * "hostVer": "-",
1740
+ * "uniVer": "-",
1741
+ * "unixVer": "-"
1742
+ * },
1743
+ * "qq": {
1744
+ * "hostVer": "-",
1745
+ * "uniVer": "-",
1746
+ * "unixVer": "-"
1747
+ * },
1748
+ * "kuaishou": {
1749
+ * "hostVer": "-",
1750
+ * "uniVer": "-",
1751
+ * "unixVer": "-"
1752
+ * },
1753
+ * "jd": {
1754
+ * "hostVer": "-",
1755
+ * "uniVer": "-",
1756
+ * "unixVer": "-"
1757
+ * }
1758
+ * }
1759
+ * }
1760
+ */
1761
+ success?: ((result: GeneralCallbackResult) => void) | null,
1762
+
1763
+ /**
1764
+ * 接口调用失败的回调函数
1765
+ * @defaultValue null
1766
+ * @uniPlatform {
1767
+ * "mp": {
1768
+ * "weixin": {
1769
+ * "hostVer": "",
1770
+ * "uniVer": "",
1771
+ * "unixVer": "4.41"
1772
+ * },
1773
+ * "alipay": {
1774
+ * "hostVer": "-",
1775
+ * "uniVer": "-",
1776
+ * "unixVer": "-"
1777
+ * },
1778
+ * "baidu": {
1779
+ * "hostVer": "-",
1780
+ * "uniVer": "-",
1781
+ * "unixVer": "-"
1782
+ * },
1783
+ * "toutiao": {
1784
+ * "hostVer": "-",
1785
+ * "uniVer": "-",
1786
+ * "unixVer": "-"
1787
+ * },
1788
+ * "lark": {
1789
+ * "hostVer": "-",
1790
+ * "uniVer": "-",
1791
+ * "unixVer": "-"
1792
+ * },
1793
+ * "qq": {
1794
+ * "hostVer": "-",
1795
+ * "uniVer": "-",
1796
+ * "unixVer": "-"
1797
+ * },
1798
+ * "kuaishou": {
1799
+ * "hostVer": "-",
1800
+ * "uniVer": "-",
1801
+ * "unixVer": "-"
1802
+ * },
1803
+ * "jd": {
1804
+ * "hostVer": "-",
1805
+ * "uniVer": "-",
1806
+ * "unixVer": "-"
1807
+ * }
1808
+ * }
1809
+ * }
1810
+ */
1811
+ fail?: ((result: GeneralCallbackResult) => void) | null,
1812
+
1813
+ /**
1814
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
1815
+ * @defaultValue null
1816
+ * @uniPlatform {
1817
+ * "mp": {
1818
+ * "weixin": {
1819
+ * "hostVer": "",
1820
+ * "uniVer": "√",
1821
+ * "unixVer": "4.41"
1822
+ * },
1823
+ * "alipay": {
1824
+ * "hostVer": "-",
1825
+ * "uniVer": "-",
1826
+ * "unixVer": "-"
1827
+ * },
1828
+ * "baidu": {
1829
+ * "hostVer": "-",
1830
+ * "uniVer": "-",
1831
+ * "unixVer": "-"
1832
+ * },
1833
+ * "toutiao": {
1834
+ * "hostVer": "-",
1835
+ * "uniVer": "-",
1836
+ * "unixVer": "-"
1837
+ * },
1838
+ * "lark": {
1839
+ * "hostVer": "-",
1840
+ * "uniVer": "-",
1841
+ * "unixVer": "-"
1842
+ * },
1843
+ * "qq": {
1844
+ * "hostVer": "-",
1845
+ * "uniVer": "-",
1846
+ * "unixVer": "-"
1847
+ * },
1848
+ * "kuaishou": {
1849
+ * "hostVer": "-",
1850
+ * "uniVer": "-",
1851
+ * "unixVer": "-"
1852
+ * },
1853
+ * "jd": {
1854
+ * "hostVer": "-",
1855
+ * "uniVer": "-",
1856
+ * "unixVer": "-"
1857
+ * }
1858
+ * }
1859
+ * }
1860
+ */
1861
+ complete?: ((result: GeneralCallbackResult) => void) | null
1790
1862
  };
1863
+
1791
1864
  export type OnSocketOpenCallbackResult = {
1792
- /**
1793
- * 连接成功的 HTTP 响应 Header
1794
- * @uniPlatform
1795
- * {
1796
- * "app": {
1797
- * "android": {
1798
- * "osVer": "5.0",
1799
- * "uniVer": "√",
1800
- * "unixVer": "3.9+"
1801
- * },
1802
- * "ios": {
1803
- * "osVer": "12.0",
1804
- * "uniVer": "√",
1805
- * "unixVer": "4.11"
1806
- * },
1807
- * "harmony": {
1808
- * "osVer": "3.0",
1809
- * "uniVer": "4.23",
1810
- * "unixVer": "x"
1811
- * }
1812
- * },
1813
- * "mp": {
1814
- * "weixin": {
1815
- * "hostVer": "√",
1816
- * "uniVer": "√",
1817
- * "unixVer": "4.41"
1818
- * },
1819
- * "alipay": {
1820
- * "hostVer": "√",
1821
- * "uniVer": "",
1822
- * "unixVer": "x"
1823
- * },
1824
- * "baidu": {
1825
- * "hostVer": "√",
1826
- * "uniVer": "",
1827
- * "unixVer": "x"
1828
- * },
1829
- * "toutiao": {
1830
- * "hostVer": "√",
1831
- * "uniVer": "",
1832
- * "unixVer": "x"
1833
- * },
1834
- * "lark": {
1835
- * "hostVer": "√",
1836
- * "uniVer": "",
1837
- * "unixVer": "x"
1838
- * },
1839
- * "qq": {
1840
- * "hostVer": "√",
1841
- * "uniVer": "",
1842
- * "unixVer": "x"
1843
- * },
1844
- * "kuaishou": {
1845
- * "hostVer": "√",
1846
- * "uniVer": "",
1847
- * "unixVer": "x"
1848
- * },
1849
- * "jd": {
1850
- * "hostVer": "√",
1851
- * "uniVer": "",
1852
- * "unixVer": "x"
1853
- * }
1854
- * }
1855
- * }
1856
- */
1857
- header: any
1865
+ /**
1866
+ * 连接成功的 HTTP 响应 Header
1867
+ * @uniPlatform
1868
+ {
1869
+ "app": {
1870
+ "android": {
1871
+ "osVer": "4.4",
1872
+ "uniVer": "√",
1873
+ "uniUtsPlugin": "3.91",
1874
+ "unixVer": "3.91",
1875
+ "unixUtsPlugin": "3.91"
1876
+ },
1877
+ "ios": {
1878
+ "osVer": "12.0",
1879
+ "uniVer": "√",
1880
+ "uniUtsPlugin": "4.11",
1881
+ "unixVer": "4.11",
1882
+ "unixUtsPlugin": "4.11"
1883
+ },
1884
+ "harmony": {
1885
+ "osVer": "3.0",
1886
+ "uniVer": "4.23",
1887
+ "unixVer": "x"
1888
+ }
1889
+ },
1890
+ "mp": {
1891
+ "weixin": {
1892
+ "hostVer": "√",
1893
+ "uniVer": "√",
1894
+ "unixVer": "4.41"
1895
+ },
1896
+ "alipay": {
1897
+ "hostVer": "√",
1898
+ "uniVer": "√",
1899
+ "unixVer": "x"
1900
+ },
1901
+ "baidu": {
1902
+ "hostVer": "√",
1903
+ "uniVer": "√",
1904
+ "unixVer": "x"
1905
+ },
1906
+ "toutiao": {
1907
+ "hostVer": "√",
1908
+ "uniVer": "√",
1909
+ "unixVer": "x"
1910
+ },
1911
+ "lark": {
1912
+ "hostVer": "√",
1913
+ "uniVer": "√",
1914
+ "unixVer": "x"
1915
+ },
1916
+ "qq": {
1917
+ "hostVer": "√",
1918
+ "uniVer": "√",
1919
+ "unixVer": "x"
1920
+ },
1921
+ "kuaishou": {
1922
+ "hostVer": "√",
1923
+ "uniVer": "√",
1924
+ "unixVer": "x"
1925
+ },
1926
+ "jd": {
1927
+ "hostVer": "√",
1928
+ "uniVer": "√",
1929
+ "unixVer": "x"
1930
+ }
1931
+ }
1932
+ }
1933
+ */
1934
+ header: any
1858
1935
  };
1936
+
1859
1937
  export type OnSocketMessageCallbackResult = {
1860
- /**
1861
- * 服务器返回的消息
1862
- * @type {SocketDataOptions}
1863
- * @uniPlatform
1864
- * {
1865
- * "app": {
1866
- * "android": {
1867
- * "osVer": "5.0",
1868
- * "uniVer": "√",
1869
- * "unixVer": "3.9+"
1870
- * },
1871
- * "ios": {
1872
- * "osVer": "12.0",
1873
- * "uniVer": "√",
1874
- * "unixVer": "4.11"
1875
- * },
1876
- * "harmony": {
1877
- * "osVer": "3.0",
1878
- * "uniVer": "4.23",
1879
- * "unixVer": "x"
1880
- * }
1881
- * },
1882
- * "mp": {
1883
- * "weixin": {
1884
- * "hostVer": "√",
1885
- * "uniVer": "√",
1886
- * "unixVer": "4.41"
1887
- * },
1888
- * "alipay": {
1889
- * "hostVer": "√",
1890
- * "uniVer": "",
1891
- * "unixVer": "x"
1892
- * },
1893
- * "baidu": {
1894
- * "hostVer": "√",
1895
- * "uniVer": "",
1896
- * "unixVer": "x"
1897
- * },
1898
- * "toutiao": {
1899
- * "hostVer": "√",
1900
- * "uniVer": "",
1901
- * "unixVer": "x"
1902
- * },
1903
- * "lark": {
1904
- * "hostVer": "√",
1905
- * "uniVer": "",
1906
- * "unixVer": "x"
1907
- * },
1908
- * "qq": {
1909
- * "hostVer": "√",
1910
- * "uniVer": "",
1911
- * "unixVer": "x"
1912
- * },
1913
- * "kuaishou": {
1914
- * "hostVer": "√",
1915
- * "uniVer": "",
1916
- * "unixVer": "x"
1917
- * },
1918
- * "jd": {
1919
- * "hostVer": "√",
1920
- * "uniVer": "",
1921
- * "unixVer": "x"
1922
- * }
1923
- * }
1924
- * }
1925
- */
1926
- data: any
1938
+ /**
1939
+ * 服务器返回的消息
1940
+ * @type {SocketDataOptions}
1941
+ * @uniPlatform
1942
+ {
1943
+ "app": {
1944
+ "android": {
1945
+ "osVer": "4.4",
1946
+ "uniVer": "√",
1947
+ "uniUtsPlugin": "3.91",
1948
+ "unixVer": "3.91",
1949
+ "unixUtsPlugin": "3.91"
1950
+ },
1951
+ "ios": {
1952
+ "osVer": "12.0",
1953
+ "uniVer": "√",
1954
+ "uniUtsPlugin": "4.11",
1955
+ "unixVer": "4.11",
1956
+ "unixUtsPlugin": "4.11"
1957
+ },
1958
+ "harmony": {
1959
+ "osVer": "3.0",
1960
+ "uniVer": "4.23",
1961
+ "unixVer": "x"
1962
+ }
1963
+ },
1964
+ "mp": {
1965
+ "weixin": {
1966
+ "hostVer": "√",
1967
+ "uniVer": "√",
1968
+ "unixVer": "4.41"
1969
+ },
1970
+ "alipay": {
1971
+ "hostVer": "√",
1972
+ "uniVer": "√",
1973
+ "unixVer": "x"
1974
+ },
1975
+ "baidu": {
1976
+ "hostVer": "√",
1977
+ "uniVer": "√",
1978
+ "unixVer": "x"
1979
+ },
1980
+ "toutiao": {
1981
+ "hostVer": "√",
1982
+ "uniVer": "√",
1983
+ "unixVer": "x"
1984
+ },
1985
+ "lark": {
1986
+ "hostVer": "√",
1987
+ "uniVer": "√",
1988
+ "unixVer": "x"
1989
+ },
1990
+ "qq": {
1991
+ "hostVer": "√",
1992
+ "uniVer": "√",
1993
+ "unixVer": "x"
1994
+ },
1995
+ "kuaishou": {
1996
+ "hostVer": "√",
1997
+ "uniVer": "√",
1998
+ "unixVer": "x"
1999
+ },
2000
+ "jd": {
2001
+ "hostVer": "√",
2002
+ "uniVer": "√",
2003
+ "unixVer": "x"
2004
+ }
2005
+ }
2006
+ }
2007
+ */
2008
+ data: any
1927
2009
  };
2010
+
1928
2011
  export interface SocketTask {
1929
- /**
1930
- * 通过 WebSocket 连接发送数据
1931
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-send
1932
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#send
1933
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#send
1934
- * @uniPlatform
1935
- * {
1936
- * "app": {
1937
- * "android": {
1938
- * "osVer": "4.4",
1939
- * "uniVer": "√",
1940
- * "unixVer": "3.9+"
1941
- * },
1942
- * "ios": {
1943
- * "osVer": "12.0",
1944
- * "uniVer": "√",
1945
- * "unixVer": "4.11"
1946
- * },
1947
- * "harmony": {
1948
- * "osVer": "3.0",
1949
- * "uniVer": "4.23",
1950
- * "unixVer": "x"
1951
- * }
1952
- * },
1953
- * "mp": {
1954
- * "weixin": {
1955
- * "hostVer": "√",
1956
- * "uniVer": "√",
1957
- * "unixVer": "4.41"
1958
- * },
1959
- * "alipay": {
1960
- * "hostVer": "√",
1961
- * "uniVer": "",
1962
- * "unixVer": "x"
1963
- * },
1964
- * "baidu": {
1965
- * "hostVer": "√",
1966
- * "uniVer": "",
1967
- * "unixVer": "x"
1968
- * },
1969
- * "toutiao": {
1970
- * "hostVer": "√",
1971
- * "uniVer": "",
1972
- * "unixVer": "x"
1973
- * },
1974
- * "lark": {
1975
- * "hostVer": "√",
1976
- * "uniVer": "",
1977
- * "unixVer": "x"
1978
- * },
1979
- * "qq": {
1980
- * "hostVer": "√",
1981
- * "uniVer": "",
1982
- * "unixVer": "x"
1983
- * },
1984
- * "kuaishou": {
1985
- * "hostVer": "√",
1986
- * "uniVer": "",
1987
- * "unixVer": "x"
1988
- * },
1989
- * "jd": {
1990
- * "hostVer": "√",
1991
- * "uniVer": "",
1992
- * "unixVer": "x"
1993
- * }
1994
- * },
1995
- * "web": {
1996
- * "uniVer": "",
1997
- * "unixVer": "4.0"
1998
- * }
1999
- * }
2000
- * @example
2001
- ```typescript
2002
- task.send({data:"halo"});
2003
- ```
2004
- */
2005
- send(options: SendSocketMessageOptions): void;
2006
- /**
2007
- * 关闭 WebSocket 连接
2008
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-close
2009
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#close
2010
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#close
2011
- * @uniPlatform
2012
- * {
2013
- * "app": {
2014
- * "android": {
2015
- * "osVer": "4.4",
2016
- * "uniVer": "√",
2017
- * "unixVer": "3.9+"
2018
- * },
2019
- * "ios": {
2020
- * "osVer": "12.0",
2021
- * "uniVer": "√",
2022
- * "unixVer": "4.11"
2023
- * },
2024
- * "harmony": {
2025
- * "osVer": "3.0",
2026
- * "uniVer": "4.23",
2027
- * "unixVer": "x"
2028
- * }
2029
- * },
2030
- * "mp": {
2031
- * "weixin": {
2032
- * "hostVer": "√",
2033
- * "uniVer": "√",
2034
- * "unixVer": "4.41"
2035
- * },
2036
- * "alipay": {
2037
- * "hostVer": "√",
2038
- * "uniVer": "√",
2039
- * "unixVer": "x"
2040
- * },
2041
- * "baidu": {
2042
- * "hostVer": "√",
2043
- * "uniVer": "",
2044
- * "unixVer": "x"
2045
- * },
2046
- * "toutiao": {
2047
- * "hostVer": "√",
2048
- * "uniVer": "",
2049
- * "unixVer": "x"
2050
- * },
2051
- * "lark": {
2052
- * "hostVer": "√",
2053
- * "uniVer": "",
2054
- * "unixVer": "x"
2055
- * },
2056
- * "qq": {
2057
- * "hostVer": "√",
2058
- * "uniVer": "",
2059
- * "unixVer": "x"
2060
- * },
2061
- * "kuaishou": {
2062
- * "hostVer": "√",
2063
- * "uniVer": "",
2064
- * "unixVer": "x"
2065
- * },
2066
- * "jd": {
2067
- * "hostVer": "√",
2068
- * "uniVer": "",
2069
- * "unixVer": "x"
2070
- * }
2071
- * },
2072
- * "web": {
2073
- * "uniVer": "",
2074
- * "unixVer": "4.0"
2075
- * }
2076
- * }
2077
- * @example
2078
- ```typescript
2079
- task.close();
2080
- ```
2081
- */
2082
- close(options: CloseSocketOptions): void;
2083
- /**
2084
- * 监听 WebSocket 连接打开事件
2085
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onopen
2086
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onopen
2087
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onopen
2088
- * @uniPlatform
2089
- * {
2090
- * "app": {
2091
- * "android": {
2092
- * "osVer": "4.4",
2093
- * "uniVer": "√",
2094
- * "unixVer": "3.9+"
2095
- * },
2096
- * "ios": {
2097
- * "osVer": "12.0",
2098
- * "uniVer": "√",
2099
- * "unixVer": "4.11"
2100
- * },
2101
- * "harmony": {
2102
- * "osVer": "3.0",
2103
- * "uniVer": "4.23",
2104
- * "unixVer": "x"
2105
- * }
2106
- * },
2107
- * "mp": {
2108
- * "weixin": {
2109
- * "hostVer": "",
2110
- * "uniVer": "√",
2111
- * "unixVer": "4.41"
2112
- * },
2113
- * "alipay": {
2114
- * "hostVer": "√",
2115
- * "uniVer": "√",
2116
- * "unixVer": "x"
2117
- * },
2118
- * "baidu": {
2119
- * "hostVer": "√",
2120
- * "uniVer": "√",
2121
- * "unixVer": "x"
2122
- * },
2123
- * "toutiao": {
2124
- * "hostVer": "√",
2125
- * "uniVer": "",
2126
- * "unixVer": "x"
2127
- * },
2128
- * "lark": {
2129
- * "hostVer": "√",
2130
- * "uniVer": "",
2131
- * "unixVer": "x"
2132
- * },
2133
- * "qq": {
2134
- * "hostVer": "√",
2135
- * "uniVer": "",
2136
- * "unixVer": "x"
2137
- * },
2138
- * "kuaishou": {
2139
- * "hostVer": "√",
2140
- * "uniVer": "",
2141
- * "unixVer": "x"
2142
- * },
2143
- * "jd": {
2144
- * "hostVer": "√",
2145
- * "uniVer": "",
2146
- * "unixVer": "x"
2147
- * }
2148
- * },
2149
- * "web": {
2150
- * "uniVer": "",
2151
- * "unixVer": "4.0"
2152
- * }
2153
- * }
2154
- * @example
2155
- ```typescript
2156
- task.onOpen((res) => {})
2157
- ```
2158
- */
2159
- onOpen(callback: (result: OnSocketOpenCallbackResult) => void): void;
2160
- /**
2161
- * 监听 WebSocket 连接关闭事件
2162
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onclose
2163
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onclose
2164
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onclose
2165
- * @uniPlatform
2166
- * {
2167
- * "app": {
2168
- * "android": {
2169
- * "osVer": "4.4",
2170
- * "uniVer": "√",
2171
- * "unixVer": "3.9+"
2172
- * },
2173
- * "ios": {
2174
- * "osVer": "12.0",
2175
- * "uniVer": "√",
2176
- * "unixVer": "4.11"
2177
- * },
2178
- * "harmony": {
2179
- * "osVer": "3.0",
2180
- * "uniVer": "4.23",
2181
- * "unixVer": "x"
2182
- * }
2183
- * },
2184
- * "mp": {
2185
- * "weixin": {
2186
- * "hostVer": "",
2187
- * "uniVer": "",
2188
- * "unixVer": "4.41"
2189
- * },
2190
- * "alipay": {
2191
- * "hostVer": "",
2192
- * "uniVer": "√",
2193
- * "unixVer": "x"
2194
- * },
2195
- * "baidu": {
2196
- * "hostVer": "√",
2197
- * "uniVer": "√",
2198
- * "unixVer": "x"
2199
- * },
2200
- * "toutiao": {
2201
- * "hostVer": "√",
2202
- * "uniVer": "√",
2203
- * "unixVer": "x"
2204
- * },
2205
- * "lark": {
2206
- * "hostVer": "√",
2207
- * "uniVer": "",
2208
- * "unixVer": "x"
2209
- * },
2210
- * "qq": {
2211
- * "hostVer": "√",
2212
- * "uniVer": "",
2213
- * "unixVer": "x"
2214
- * },
2215
- * "kuaishou": {
2216
- * "hostVer": "√",
2217
- * "uniVer": "",
2218
- * "unixVer": "x"
2219
- * },
2220
- * "jd": {
2221
- * "hostVer": "√",
2222
- * "uniVer": "",
2223
- * "unixVer": "x"
2224
- * }
2225
- * },
2226
- * "web": {
2227
- * "uniVer": "",
2228
- * "unixVer": "4.0"
2229
- * }
2230
- * }
2231
- * @example
2232
- ```typescript
2233
- task.onClose((res) => {
2234
- })
2235
- ```
2236
- */
2237
- onClose(callback: (result: any) => void): void;
2238
- /**
2239
- * onError()
2240
- * @description
2241
- * 监听 WebSocket 错误
2242
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onerror
2243
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onerror
2244
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onerror
2245
- * @uniPlatform
2246
- * {
2247
- * "app": {
2248
- * "android": {
2249
- * "osVer": "4.4",
2250
- * "uniVer": "√",
2251
- * "unixVer": "3.9+"
2252
- * },
2253
- * "ios": {
2254
- * "osVer": "12.0",
2255
- * "uniVer": "√",
2256
- * "unixVer": "4.11"
2257
- * },
2258
- * "harmony": {
2259
- * "osVer": "3.0",
2260
- * "uniVer": "4.23",
2261
- * "unixVer": "x"
2262
- * }
2263
- * },
2264
- * "mp": {
2265
- * "weixin": {
2266
- * "hostVer": "√",
2267
- * "uniVer": "√",
2268
- * "unixVer": "4.41"
2269
- * },
2270
- * "alipay": {
2271
- * "hostVer": "",
2272
- * "uniVer": "",
2273
- * "unixVer": "x"
2274
- * },
2275
- * "baidu": {
2276
- * "hostVer": "",
2277
- * "uniVer": "√",
2278
- * "unixVer": "x"
2279
- * },
2280
- * "toutiao": {
2281
- * "hostVer": "√",
2282
- * "uniVer": "√",
2283
- * "unixVer": "x"
2284
- * },
2285
- * "lark": {
2286
- * "hostVer": "√",
2287
- * "uniVer": "√",
2288
- * "unixVer": "x"
2289
- * },
2290
- * "qq": {
2291
- * "hostVer": "√",
2292
- * "uniVer": "",
2293
- * "unixVer": "x"
2294
- * },
2295
- * "kuaishou": {
2296
- * "hostVer": "√",
2297
- * "uniVer": "",
2298
- * "unixVer": "x"
2299
- * },
2300
- * "jd": {
2301
- * "hostVer": "√",
2302
- * "uniVer": "",
2303
- * "unixVer": "x"
2304
- * }
2305
- * },
2306
- * "web": {
2307
- * "uniVer": "",
2308
- * "unixVer": "4.0"
2309
- * }
2310
- * }
2311
- * @example
2312
- ```typescript
2313
- task.onError((res) => {
2314
- })
2315
- ```
2316
- */
2317
- onError(callback: (result: GeneralCallbackResult) => void): void;
2318
- /**
2319
- * 监听 WebSocket 接受到服务器的消息事件
2320
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onmessage
2321
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onmessage
2322
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onmessage
2323
- * @uniPlatform
2324
- * {
2325
- * "app": {
2326
- * "android": {
2327
- * "osVer": "4.4",
2328
- * "uniVer": "√",
2329
- * "unixVer": "3.9+"
2330
- * },
2331
- * "ios": {
2332
- * "osVer": "12.0",
2333
- * "uniVer": "√",
2334
- * "unixVer": "4.11"
2335
- * },
2336
- * "harmony": {
2337
- * "osVer": "3.0",
2338
- * "uniVer": "4.23",
2339
- * "unixVer": "x"
2340
- * }
2341
- * },
2342
- * "mp": {
2343
- * "weixin": {
2344
- * "hostVer": "√",
2345
- * "uniVer": "√",
2346
- * "unixVer": "4.41"
2347
- * },
2348
- * "alipay": {
2349
- * "hostVer": "√",
2350
- * "uniVer": "√",
2351
- * "unixVer": "x"
2352
- * },
2353
- * "baidu": {
2354
- * "hostVer": "",
2355
- * "uniVer": "",
2356
- * "unixVer": "x"
2357
- * },
2358
- * "toutiao": {
2359
- * "hostVer": "",
2360
- * "uniVer": "√",
2361
- * "unixVer": "x"
2362
- * },
2363
- * "lark": {
2364
- * "hostVer": "√",
2365
- * "uniVer": "√",
2366
- * "unixVer": "x"
2367
- * },
2368
- * "qq": {
2369
- * "hostVer": "√",
2370
- * "uniVer": "√",
2371
- * "unixVer": "x"
2372
- * },
2373
- * "kuaishou": {
2374
- * "hostVer": "√",
2375
- * "uniVer": "",
2376
- * "unixVer": "x"
2377
- * },
2378
- * "jd": {
2379
- * "hostVer": "√",
2380
- * "uniVer": "",
2381
- * "unixVer": "x"
2382
- * }
2383
- * },
2384
- * "web": {
2385
- * "uniVer": "",
2386
- * "unixVer": "4.0"
2387
- * }
2388
- * }
2389
- * @example
2390
- ```typescript
2391
- task.onMessage((res) => {
2392
- })
2393
- ```
2394
- */
2395
- onMessage(callback: (result: OnSocketMessageCallbackResult) => void): void;
2012
+ /**
2013
+ * 通过 WebSocket 连接发送数据
2014
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-send
2015
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#send
2016
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#send
2017
+ * @uniPlatform
2018
+ {
2019
+ "app": {
2020
+ "android": {
2021
+ "osVer": "4.4",
2022
+ "uniVer": "√",
2023
+ "uniUtsPlugin": "3.91",
2024
+ "unixVer": "3.91",
2025
+ "unixUtsPlugin": "3.91"
2026
+ },
2027
+ "ios": {
2028
+ "osVer": "12.0",
2029
+ "uniVer": "√",
2030
+ "uniUtsPlugin": "4.11",
2031
+ "unixVer": "4.11",
2032
+ "unixUtsPlugin": "4.11"
2033
+ },
2034
+ "harmony": {
2035
+ "osVer": "3.0",
2036
+ "uniVer": "4.23",
2037
+ "unixVer": "x"
2038
+ }
2039
+ },
2040
+ "mp": {
2041
+ "weixin": {
2042
+ "hostVer": "√",
2043
+ "uniVer": "√",
2044
+ "unixVer": "4.41"
2045
+ },
2046
+ "alipay": {
2047
+ "hostVer": "√",
2048
+ "uniVer": "√",
2049
+ "unixVer": "x"
2050
+ },
2051
+ "baidu": {
2052
+ "hostVer": "√",
2053
+ "uniVer": "√",
2054
+ "unixVer": "x"
2055
+ },
2056
+ "toutiao": {
2057
+ "hostVer": "√",
2058
+ "uniVer": "√",
2059
+ "unixVer": "x"
2060
+ },
2061
+ "lark": {
2062
+ "hostVer": "√",
2063
+ "uniVer": "√",
2064
+ "unixVer": "x"
2065
+ },
2066
+ "qq": {
2067
+ "hostVer": "√",
2068
+ "uniVer": "√",
2069
+ "unixVer": "x"
2070
+ },
2071
+ "kuaishou": {
2072
+ "hostVer": "√",
2073
+ "uniVer": "√",
2074
+ "unixVer": "x"
2075
+ },
2076
+ "jd": {
2077
+ "hostVer": "√",
2078
+ "uniVer": "√",
2079
+ "unixVer": "x"
2080
+ }
2081
+ },
2082
+ "web": {
2083
+ "uniVer": "√",
2084
+ "unixVer": "4.0"
2085
+ }
2086
+ }
2087
+ * @example
2088
+ ```typescript
2089
+ task.send({data:"halo"});
2090
+ ```
2091
+ */
2092
+ send(options: SendSocketMessageOptions): void;
2093
+
2094
+ /**
2095
+ * 关闭 WebSocket 连接
2096
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-close
2097
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#close
2098
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#close
2099
+ * @uniPlatform
2100
+ {
2101
+ "app": {
2102
+ "android": {
2103
+ "osVer": "4.4",
2104
+ "uniVer": "√",
2105
+ "uniUtsPlugin": "3.91",
2106
+ "unixVer": "3.91",
2107
+ "unixUtsPlugin": "3.91"
2108
+ },
2109
+ "ios": {
2110
+ "osVer": "12.0",
2111
+ "uniVer": "√",
2112
+ "uniUtsPlugin": "4.11",
2113
+ "unixVer": "4.11",
2114
+ "unixUtsPlugin": "4.11"
2115
+ },
2116
+ "harmony": {
2117
+ "osVer": "3.0",
2118
+ "uniVer": "4.23",
2119
+ "unixVer": "x"
2120
+ }
2121
+ },
2122
+ "mp": {
2123
+ "weixin": {
2124
+ "hostVer": "√",
2125
+ "uniVer": "√",
2126
+ "unixVer": "4.41"
2127
+ },
2128
+ "alipay": {
2129
+ "hostVer": "√",
2130
+ "uniVer": "√",
2131
+ "unixVer": "x"
2132
+ },
2133
+ "baidu": {
2134
+ "hostVer": "√",
2135
+ "uniVer": "√",
2136
+ "unixVer": "x"
2137
+ },
2138
+ "toutiao": {
2139
+ "hostVer": "√",
2140
+ "uniVer": "√",
2141
+ "unixVer": "x"
2142
+ },
2143
+ "lark": {
2144
+ "hostVer": "√",
2145
+ "uniVer": "√",
2146
+ "unixVer": "x"
2147
+ },
2148
+ "qq": {
2149
+ "hostVer": "√",
2150
+ "uniVer": "√",
2151
+ "unixVer": "x"
2152
+ },
2153
+ "kuaishou": {
2154
+ "hostVer": "√",
2155
+ "uniVer": "√",
2156
+ "unixVer": "x"
2157
+ },
2158
+ "jd": {
2159
+ "hostVer": "√",
2160
+ "uniVer": "√",
2161
+ "unixVer": "x"
2162
+ }
2163
+ },
2164
+ "web": {
2165
+ "uniVer": "√",
2166
+ "unixVer": "4.0"
2167
+ }
2168
+ }
2169
+ * @example
2170
+ ```typescript
2171
+ task.close();
2172
+ ```
2173
+ */
2174
+ close(options: CloseSocketOptions): void;
2175
+
2176
+ /**
2177
+ * 监听 WebSocket 连接打开事件
2178
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onopen
2179
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onopen
2180
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onopen
2181
+ * @uniPlatform
2182
+ {
2183
+ "app": {
2184
+ "android": {
2185
+ "osVer": "4.4",
2186
+ "uniVer": "",
2187
+ "uniUtsPlugin": "3.91",
2188
+ "unixVer": "3.91",
2189
+ "unixUtsPlugin": "3.91"
2190
+ },
2191
+ "ios": {
2192
+ "osVer": "12.0",
2193
+ "uniVer": "√",
2194
+ "uniUtsPlugin": "4.11",
2195
+ "unixVer": "4.11",
2196
+ "unixUtsPlugin": "4.11"
2197
+ },
2198
+ "harmony": {
2199
+ "osVer": "3.0",
2200
+ "uniVer": "4.23",
2201
+ "unixVer": "x"
2202
+ }
2203
+ },
2204
+ "mp": {
2205
+ "weixin": {
2206
+ "hostVer": "√",
2207
+ "uniVer": "√",
2208
+ "unixVer": "4.41"
2209
+ },
2210
+ "alipay": {
2211
+ "hostVer": "√",
2212
+ "uniVer": "√",
2213
+ "unixVer": "x"
2214
+ },
2215
+ "baidu": {
2216
+ "hostVer": "√",
2217
+ "uniVer": "√",
2218
+ "unixVer": "x"
2219
+ },
2220
+ "toutiao": {
2221
+ "hostVer": "√",
2222
+ "uniVer": "√",
2223
+ "unixVer": "x"
2224
+ },
2225
+ "lark": {
2226
+ "hostVer": "√",
2227
+ "uniVer": "√",
2228
+ "unixVer": "x"
2229
+ },
2230
+ "qq": {
2231
+ "hostVer": "√",
2232
+ "uniVer": "√",
2233
+ "unixVer": "x"
2234
+ },
2235
+ "kuaishou": {
2236
+ "hostVer": "√",
2237
+ "uniVer": "√",
2238
+ "unixVer": "x"
2239
+ },
2240
+ "jd": {
2241
+ "hostVer": "√",
2242
+ "uniVer": "√",
2243
+ "unixVer": "x"
2244
+ }
2245
+ },
2246
+ "web": {
2247
+ "uniVer": "√",
2248
+ "unixVer": "4.0"
2249
+ }
2250
+ }
2251
+ * @example
2252
+ ```typescript
2253
+ task.onOpen((res) => {})
2254
+ ```
2255
+ */
2256
+ onOpen(callback: (result: OnSocketOpenCallbackResult) => void): void;
2257
+
2258
+ /**
2259
+ * 监听 WebSocket 连接关闭事件
2260
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onclose
2261
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onclose
2262
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onclose
2263
+ * @uniPlatform
2264
+ {
2265
+ "app": {
2266
+ "android": {
2267
+ "osVer": "4.4",
2268
+ "uniVer": "√",
2269
+ "uniUtsPlugin": "3.91",
2270
+ "unixVer": "3.91",
2271
+ "unixUtsPlugin": "3.91"
2272
+ },
2273
+ "ios": {
2274
+ "osVer": "12.0",
2275
+ "uniVer": "√",
2276
+ "uniUtsPlugin": "4.11",
2277
+ "unixVer": "4.11",
2278
+ "unixUtsPlugin": "4.11"
2279
+ },
2280
+ "harmony": {
2281
+ "osVer": "3.0",
2282
+ "uniVer": "4.23",
2283
+ "unixVer": "x"
2284
+ }
2285
+ },
2286
+ "mp": {
2287
+ "weixin": {
2288
+ "hostVer": "√",
2289
+ "uniVer": "√",
2290
+ "unixVer": "4.41"
2291
+ },
2292
+ "alipay": {
2293
+ "hostVer": "√",
2294
+ "uniVer": "√",
2295
+ "unixVer": "x"
2296
+ },
2297
+ "baidu": {
2298
+ "hostVer": "√",
2299
+ "uniVer": "√",
2300
+ "unixVer": "x"
2301
+ },
2302
+ "toutiao": {
2303
+ "hostVer": "√",
2304
+ "uniVer": "√",
2305
+ "unixVer": "x"
2306
+ },
2307
+ "lark": {
2308
+ "hostVer": "√",
2309
+ "uniVer": "√",
2310
+ "unixVer": "x"
2311
+ },
2312
+ "qq": {
2313
+ "hostVer": "√",
2314
+ "uniVer": "√",
2315
+ "unixVer": "x"
2316
+ },
2317
+ "kuaishou": {
2318
+ "hostVer": "√",
2319
+ "uniVer": "√",
2320
+ "unixVer": "x"
2321
+ },
2322
+ "jd": {
2323
+ "hostVer": "√",
2324
+ "uniVer": "√",
2325
+ "unixVer": "x"
2326
+ }
2327
+ },
2328
+ "web": {
2329
+ "uniVer": "√",
2330
+ "unixVer": "4.0"
2331
+ }
2332
+ }
2333
+ * @example
2334
+ ```typescript
2335
+ task.onClose((res) => {
2336
+ })
2337
+ ```
2338
+ */
2339
+ onClose(callback: (result: any) => void): void;
2340
+
2341
+ /**
2342
+ * onError()
2343
+ * @description
2344
+ * 监听 WebSocket 错误
2345
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onerror
2346
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onerror
2347
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onerror
2348
+ * @uniPlatform
2349
+ {
2350
+ "app": {
2351
+ "android": {
2352
+ "osVer": "4.4",
2353
+ "uniVer": "√",
2354
+ "uniUtsPlugin": "3.91",
2355
+ "unixVer": "3.91",
2356
+ "unixUtsPlugin": "3.91"
2357
+ },
2358
+ "ios": {
2359
+ "osVer": "12.0",
2360
+ "uniVer": "√",
2361
+ "uniUtsPlugin": "4.11",
2362
+ "unixVer": "4.11",
2363
+ "unixUtsPlugin": "4.11"
2364
+ },
2365
+ "harmony": {
2366
+ "osVer": "3.0",
2367
+ "uniVer": "4.23",
2368
+ "unixVer": "x"
2369
+ }
2370
+ },
2371
+ "mp": {
2372
+ "weixin": {
2373
+ "hostVer": "√",
2374
+ "uniVer": "√",
2375
+ "unixVer": "4.41"
2376
+ },
2377
+ "alipay": {
2378
+ "hostVer": "√",
2379
+ "uniVer": "√",
2380
+ "unixVer": "x"
2381
+ },
2382
+ "baidu": {
2383
+ "hostVer": "√",
2384
+ "uniVer": "√",
2385
+ "unixVer": "x"
2386
+ },
2387
+ "toutiao": {
2388
+ "hostVer": "√",
2389
+ "uniVer": "√",
2390
+ "unixVer": "x"
2391
+ },
2392
+ "lark": {
2393
+ "hostVer": "√",
2394
+ "uniVer": "√",
2395
+ "unixVer": "x"
2396
+ },
2397
+ "qq": {
2398
+ "hostVer": "√",
2399
+ "uniVer": "√",
2400
+ "unixVer": "x"
2401
+ },
2402
+ "kuaishou": {
2403
+ "hostVer": "√",
2404
+ "uniVer": "√",
2405
+ "unixVer": "x"
2406
+ },
2407
+ "jd": {
2408
+ "hostVer": "√",
2409
+ "uniVer": "√",
2410
+ "unixVer": "x"
2411
+ }
2412
+ },
2413
+ "web": {
2414
+ "uniVer": "√",
2415
+ "unixVer": "4.0"
2416
+ }
2417
+ }
2418
+ * @example
2419
+ ```typescript
2420
+ task.onError((res) => {
2421
+ })
2422
+ ```
2423
+ */
2424
+ onError(callback: (result: GeneralCallbackResult) => void): void;
2425
+
2426
+ /**
2427
+ * 监听 WebSocket 接受到服务器的消息事件
2428
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onmessage
2429
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onmessage
2430
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/websocket-global.html#onmessage
2431
+ * @uniPlatform
2432
+ {
2433
+ "app": {
2434
+ "android": {
2435
+ "osVer": "4.4",
2436
+ "uniVer": "√",
2437
+ "uniUtsPlugin": "3.91",
2438
+ "unixVer": "3.91",
2439
+ "unixUtsPlugin": "3.91"
2440
+ },
2441
+ "ios": {
2442
+ "osVer": "12.0",
2443
+ "uniVer": "√",
2444
+ "uniUtsPlugin": "4.11",
2445
+ "unixVer": "4.11",
2446
+ "unixUtsPlugin": "4.11"
2447
+ },
2448
+ "harmony": {
2449
+ "osVer": "3.0",
2450
+ "uniVer": "4.23",
2451
+ "unixVer": "x"
2452
+ }
2453
+ },
2454
+ "mp": {
2455
+ "weixin": {
2456
+ "hostVer": "√",
2457
+ "uniVer": "√",
2458
+ "unixVer": "4.41"
2459
+ },
2460
+ "alipay": {
2461
+ "hostVer": "√",
2462
+ "uniVer": "√",
2463
+ "unixVer": "x"
2464
+ },
2465
+ "baidu": {
2466
+ "hostVer": "√",
2467
+ "uniVer": "√",
2468
+ "unixVer": "x"
2469
+ },
2470
+ "toutiao": {
2471
+ "hostVer": "√",
2472
+ "uniVer": "√",
2473
+ "unixVer": "x"
2474
+ },
2475
+ "lark": {
2476
+ "hostVer": "√",
2477
+ "uniVer": "√",
2478
+ "unixVer": "x"
2479
+ },
2480
+ "qq": {
2481
+ "hostVer": "√",
2482
+ "uniVer": "√",
2483
+ "unixVer": "x"
2484
+ },
2485
+ "kuaishou": {
2486
+ "hostVer": "√",
2487
+ "uniVer": "√",
2488
+ "unixVer": "x"
2489
+ },
2490
+ "jd": {
2491
+ "hostVer": "√",
2492
+ "uniVer": "√",
2493
+ "unixVer": "x"
2494
+ }
2495
+ },
2496
+ "web": {
2497
+ "uniVer": "√",
2498
+ "unixVer": "4.0"
2499
+ }
2500
+ }
2501
+ * @example
2502
+ ```typescript
2503
+ task.onMessage((res) => {
2504
+ })
2505
+ ```
2506
+ */
2507
+ onMessage(callback: (result: OnSocketMessageCallbackResult) => void): void;
2396
2508
  };
2397
2509
  export type OnSocketOpenCallback = (result: OnSocketOpenCallbackResult) => void;
2398
2510
 
@@ -2458,138 +2570,147 @@ export type OnSocketMessage = (callback: OnSocketMessageCallback) => void;
2458
2570
 
2459
2571
  export type CloseSocket = (options: CloseSocketOptions) => void;
2460
2572
  export type OnSocketCloseCallbackResult = {
2461
- /**
2462
- * 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。
2463
- * @uniPlatform
2464
- * {
2465
- * "app": {
2466
- * "android": {
2467
- * "osVer": "5.0",
2468
- * "uniVer": "√",
2469
- * "unixVer": "3.9+"
2470
- * },
2471
- * "ios": {
2472
- * "osVer": "12.0",
2473
- * "uniVer": "√",
2474
- * "unixVer": "4.11"
2475
- * },
2476
- * "harmony": {
2477
- * "osVer": "3.0",
2478
- * "uniVer": "4.23",
2479
- * "unixVer": "x"
2480
- * }
2481
- * },
2482
- * "mp": {
2483
- * "weixin": {
2484
- * "hostVer": "√",
2485
- * "uniVer": "√",
2486
- * "unixVer": "4.41"
2487
- * },
2488
- * "alipay": {
2489
- * "hostVer": "√",
2490
- * "uniVer": "",
2491
- * "unixVer": "x"
2492
- * },
2493
- * "baidu": {
2494
- * "hostVer": "√",
2495
- * "uniVer": "",
2496
- * "unixVer": "x"
2497
- * },
2498
- * "toutiao": {
2499
- * "hostVer": "√",
2500
- * "uniVer": "",
2501
- * "unixVer": "x"
2502
- * },
2503
- * "lark": {
2504
- * "hostVer": "√",
2505
- * "uniVer": "",
2506
- * "unixVer": "x"
2507
- * },
2508
- * "qq": {
2509
- * "hostVer": "√",
2510
- * "uniVer": "",
2511
- * "unixVer": "x"
2512
- * },
2513
- * "kuaishou": {
2514
- * "hostVer": "√",
2515
- * "uniVer": "",
2516
- * "unixVer": "x"
2517
- * },
2518
- * "jd": {
2519
- * "hostVer": "√",
2520
- * "uniVer": "",
2521
- * "unixVer": "x"
2522
- * }
2523
- * }
2524
- * }
2525
- */
2526
- code: number,
2527
- /**
2528
- * 一个可读的字符串,表示连接被关闭的原因。
2529
- * @uniPlatform
2530
- * {
2531
- * "app": {
2532
- * "android": {
2533
- * "osVer": "5.0",
2534
- * "uniVer": "√",
2535
- * "unixVer": "3.9+"
2536
- * },
2537
- * "ios": {
2538
- * "osVer": "12.0",
2539
- * "uniVer": "√",
2540
- * "unixVer": "4.11"
2541
- * },
2542
- * "harmony": {
2543
- * "osVer": "3.0",
2544
- * "uniVer": "4.23",
2545
- * "unixVer": "x"
2546
- * }
2547
- * },
2548
- * "mp": {
2549
- * "weixin": {
2550
- * "hostVer": "√",
2551
- * "uniVer": "√",
2552
- * "unixVer": "4.41"
2553
- * },
2554
- * "alipay": {
2555
- * "hostVer": "√",
2556
- * "uniVer": "√",
2557
- * "unixVer": "x"
2558
- * },
2559
- * "baidu": {
2560
- * "hostVer": "√",
2561
- * "uniVer": "",
2562
- * "unixVer": "x"
2563
- * },
2564
- * "toutiao": {
2565
- * "hostVer": "√",
2566
- * "uniVer": "",
2567
- * "unixVer": "x"
2568
- * },
2569
- * "lark": {
2570
- * "hostVer": "√",
2571
- * "uniVer": "",
2572
- * "unixVer": "x"
2573
- * },
2574
- * "qq": {
2575
- * "hostVer": "√",
2576
- * "uniVer": "",
2577
- * "unixVer": "x"
2578
- * },
2579
- * "kuaishou": {
2580
- * "hostVer": "√",
2581
- * "uniVer": "",
2582
- * "unixVer": "x"
2583
- * },
2584
- * "jd": {
2585
- * "hostVer": "√",
2586
- * "uniVer": "",
2587
- * "unixVer": "x"
2588
- * }
2589
- * }
2590
- * }
2591
- */
2592
- reason: string
2573
+ /**
2574
+ * 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。
2575
+ * @uniPlatform
2576
+ {
2577
+ "app": {
2578
+ "android": {
2579
+ "osVer": "4.4",
2580
+ "uniVer": "√",
2581
+ "uniUtsPlugin": "3.91",
2582
+ "unixVer": "3.91",
2583
+ "unixUtsPlugin": "3.91"
2584
+ },
2585
+ "ios": {
2586
+ "osVer": "12.0",
2587
+ "uniVer": "√",
2588
+ "uniUtsPlugin": "4.11",
2589
+ "unixVer": "4.11",
2590
+ "unixUtsPlugin": "4.11"
2591
+ },
2592
+ "harmony": {
2593
+ "osVer": "3.0",
2594
+ "uniVer": "4.23",
2595
+ "unixVer": "x"
2596
+ }
2597
+ },
2598
+ "mp": {
2599
+ "weixin": {
2600
+ "hostVer": "√",
2601
+ "uniVer": "√",
2602
+ "unixVer": "4.41"
2603
+ },
2604
+ "alipay": {
2605
+ "hostVer": "√",
2606
+ "uniVer": "√",
2607
+ "unixVer": "x"
2608
+ },
2609
+ "baidu": {
2610
+ "hostVer": "√",
2611
+ "uniVer": "√",
2612
+ "unixVer": "x"
2613
+ },
2614
+ "toutiao": {
2615
+ "hostVer": "√",
2616
+ "uniVer": "√",
2617
+ "unixVer": "x"
2618
+ },
2619
+ "lark": {
2620
+ "hostVer": "√",
2621
+ "uniVer": "√",
2622
+ "unixVer": "x"
2623
+ },
2624
+ "qq": {
2625
+ "hostVer": "√",
2626
+ "uniVer": "√",
2627
+ "unixVer": "x"
2628
+ },
2629
+ "kuaishou": {
2630
+ "hostVer": "√",
2631
+ "uniVer": "√",
2632
+ "unixVer": "x"
2633
+ },
2634
+ "jd": {
2635
+ "hostVer": "√",
2636
+ "uniVer": "√",
2637
+ "unixVer": "x"
2638
+ }
2639
+ }
2640
+ }
2641
+ */
2642
+ code: number,
2643
+
2644
+ /**
2645
+ * 一个可读的字符串,表示连接被关闭的原因。
2646
+ * @uniPlatform
2647
+ {
2648
+ "app": {
2649
+ "android": {
2650
+ "osVer": "4.4",
2651
+ "uniVer": "√",
2652
+ "uniUtsPlugin": "3.91",
2653
+ "unixVer": "3.91",
2654
+ "unixUtsPlugin": "3.91"
2655
+ },
2656
+ "ios": {
2657
+ "osVer": "12.0",
2658
+ "uniVer": "√",
2659
+ "uniUtsPlugin": "4.11",
2660
+ "unixVer": "4.11",
2661
+ "unixUtsPlugin": "4.11"
2662
+ },
2663
+ "harmony": {
2664
+ "osVer": "3.0",
2665
+ "uniVer": "4.23",
2666
+ "unixVer": "x"
2667
+ }
2668
+ },
2669
+ "mp": {
2670
+ "weixin": {
2671
+ "hostVer": "√",
2672
+ "uniVer": "√",
2673
+ "unixVer": "4.41"
2674
+ },
2675
+ "alipay": {
2676
+ "hostVer": "√",
2677
+ "uniVer": "√",
2678
+ "unixVer": "x"
2679
+ },
2680
+ "baidu": {
2681
+ "hostVer": "√",
2682
+ "uniVer": "√",
2683
+ "unixVer": "x"
2684
+ },
2685
+ "toutiao": {
2686
+ "hostVer": "√",
2687
+ "uniVer": "√",
2688
+ "unixVer": "x"
2689
+ },
2690
+ "lark": {
2691
+ "hostVer": "√",
2692
+ "uniVer": "√",
2693
+ "unixVer": "x"
2694
+ },
2695
+ "qq": {
2696
+ "hostVer": "√",
2697
+ "uniVer": "√",
2698
+ "unixVer": "x"
2699
+ },
2700
+ "kuaishou": {
2701
+ "hostVer": "√",
2702
+ "uniVer": "√",
2703
+ "unixVer": "x"
2704
+ },
2705
+ "jd": {
2706
+ "hostVer": "√",
2707
+ "uniVer": "√",
2708
+ "unixVer": "x"
2709
+ }
2710
+ }
2711
+ }
2712
+ */
2713
+ reason: string
2593
2714
  };
2594
2715
  export type OnSocketCloseCallback = (result: OnSocketCloseCallbackResult) => void;
2595
2716