websocket.md 2.1 KB
Newer Older
D
DCloud_LXH 已提交
1 2 3 4
## uni.connectSocket(options) @connectsocket

<!-- UTSAPIJSON.connectSocket.description -->

D
DCloud_LXH 已提交
5 6
<!-- UTSAPIJSON.connectSocket.compatibility -->

D
DCloud_LXH 已提交
7 8 9 10 11 12 13 14 15 16
<!-- UTSAPIJSON.connectSocket.param -->

<!-- UTSAPIJSON.connectSocket.returnValue -->

<!-- UTSAPIJSON.connectSocket.tutorial -->

## uni.onSocketOpen(options) @onsocketopen

<!-- UTSAPIJSON.onSocketOpen.description -->

D
DCloud_LXH 已提交
17 18
<!-- UTSAPIJSON.onSocketOpen.compatibility -->

D
DCloud_LXH 已提交
19 20 21 22 23 24 25 26 27 28
<!-- UTSAPIJSON.onSocketOpen.param -->

<!-- UTSAPIJSON.onSocketOpen.returnValue -->

<!-- UTSAPIJSON.onSocketOpen.tutorial -->

## uni.onSocketError(callback) @onsocketerror

<!-- UTSAPIJSON.onSocketError.description -->

D
DCloud_LXH 已提交
29 30
<!-- UTSAPIJSON.onSocketError.compatibility -->

D
DCloud_LXH 已提交
31 32 33 34 35 36 37 38 39 40
<!-- UTSAPIJSON.onSocketError.param -->

<!-- UTSAPIJSON.onSocketError.returnValue -->

<!-- UTSAPIJSON.onSocketError.tutorial -->

## uni.sendSocketMessage(options) @sendsocketmessage

<!-- UTSAPIJSON.sendSocketMessage.description -->

D
DCloud_LXH 已提交
41 42
<!-- UTSAPIJSON.sendSocketMessage.compatibility -->

D
DCloud_LXH 已提交
43 44 45 46 47 48
<!-- UTSAPIJSON.sendSocketMessage.param -->

<!-- UTSAPIJSON.sendSocketMessage.returnValue -->

<!-- UTSAPIJSON.sendSocketMessage.tutorial -->

D
DCloud_LXH 已提交
49 50 51 52
## 注意事项

* 出于性能的权衡,在底层实现上发送队列占用的内存不能超过16M,一旦超过将导致连接被关闭。

D
DCloud_LXH 已提交
53 54 55 56
## uni.onSocketMessage(callback) @onsocketmessage

<!-- UTSAPIJSON.onSocketMessage.description -->

D
DCloud_LXH 已提交
57 58
<!-- UTSAPIJSON.onSocketMessage.compatibility -->

D
DCloud_LXH 已提交
59 60 61 62 63 64 65 66 67 68
<!-- UTSAPIJSON.onSocketMessage.param -->

<!-- UTSAPIJSON.onSocketMessage.returnValue -->

<!-- UTSAPIJSON.onSocketMessage.tutorial -->

## uni.closeSocket(options) @closesocket

<!-- UTSAPIJSON.closeSocket.description -->

D
DCloud_LXH 已提交
69 70
<!-- UTSAPIJSON.closeSocket.compatibility -->

D
DCloud_LXH 已提交
71 72 73 74 75 76 77 78 79 80
<!-- UTSAPIJSON.closeSocket.param -->

<!-- UTSAPIJSON.closeSocket.returnValue -->

<!-- UTSAPIJSON.closeSocket.tutorial -->

## uni.onSocketClose(callback) @onsocketclose

<!-- UTSAPIJSON.onSocketClose.description -->

D
DCloud_LXH 已提交
81 82
<!-- UTSAPIJSON.onSocketClose.compatibility -->

D
DCloud_LXH 已提交
83 84 85 86 87 88 89 90
<!-- UTSAPIJSON.onSocketClose.param -->

<!-- UTSAPIJSON.onSocketClose.returnValue -->

<!-- UTSAPIJSON.onSocketClose.tutorial -->

<!-- UTSAPIJSON.general_type.name -->

D
DCloud_LXH 已提交
91
<!-- UTSAPIJSON.general_type.param -->