websocket-global.md 2.5 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 17 18
<!-- UTSAPIJSON.connectSocket.param -->

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

<!-- UTSAPIJSON.connectSocket.example -->

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

## uni.onSocketOpen(options) @onsocketopen

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

D
DCloud_LXH 已提交
19 20
<!-- UTSAPIJSON.onSocketOpen.compatibility -->

D
DCloud_LXH 已提交
21 22 23 24 25 26 27 28 29 30 31 32
<!-- UTSAPIJSON.onSocketOpen.param -->

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

<!-- UTSAPIJSON.onSocketOpen.example -->

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

## uni.onSocketError(callback) @onsocketerror

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

D
DCloud_LXH 已提交
33 34
<!-- UTSAPIJSON.onSocketError.compatibility -->

D
DCloud_LXH 已提交
35 36 37 38 39 40 41 42 43 44 45 46
<!-- UTSAPIJSON.onSocketError.param -->

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

<!-- UTSAPIJSON.onSocketError.example -->

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

## uni.sendSocketMessage(options) @sendsocketmessage

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

D
DCloud_LXH 已提交
47 48
<!-- UTSAPIJSON.sendSocketMessage.compatibility -->

D
DCloud_LXH 已提交
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
<!-- UTSAPIJSON.sendSocketMessage.param -->

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

<!-- UTSAPIJSON.sendSocketMessage.example -->

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

## 注意事项

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

## uni.onSocketMessage(callback) @onsocketmessage

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

D
DCloud_LXH 已提交
65 66
<!-- UTSAPIJSON.onSocketMessage.compatibility -->

D
DCloud_LXH 已提交
67 68 69 70 71 72 73 74 75 76 77 78
<!-- UTSAPIJSON.onSocketMessage.param -->

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

<!-- UTSAPIJSON.onSocketMessage.example -->

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

## uni.closeSocket(options) @closesocket

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

D
DCloud_LXH 已提交
79 80
<!-- UTSAPIJSON.closeSocket.compatibility -->

D
DCloud_LXH 已提交
81 82 83 84 85 86 87 88 89 90 91 92
<!-- UTSAPIJSON.closeSocket.param -->

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

<!-- UTSAPIJSON.closeSocket.example -->

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

## uni.onSocketClose(callback) @onsocketclose

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

D
DCloud_LXH 已提交
93 94
<!-- UTSAPIJSON.onSocketClose.compatibility -->

D
DCloud_LXH 已提交
95 96 97 98 99 100 101 102 103 104 105 106 107
<!-- UTSAPIJSON.onSocketClose.param -->

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

<!-- UTSAPIJSON.onSocketClose.example -->

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

<!-- UTSAPIJSON.websocket-global.example -->

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

<!-- UTSAPIJSON.general_type.param -->