You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|[`Connection`][connection]| Connection with the given peer |
1020
+
1021
+
#### Example
1022
+
1023
+
```js
1024
+
libp2p.connectionManager.get(peerId)
1025
+
```
1026
+
1002
1027
### connectionManager.setPeerValue
1003
1028
1004
1029
Enables users to change the value of certain peers in a range of 0 to 1. Peers with the lowest values will have their Connections pruned first, if any Connection Manager limits are exceeded. See [./CONFIGURATION.md#configuring-connection-manager](./CONFIGURATION.md#configuring-connection-manager) for details on how to configure these limits.
Getter for obtaining the current number of open connections.
1056
+
1057
+
#### Example
1058
+
1059
+
```js
1060
+
libp2p.connectionManager.size
1061
+
// 10
1062
+
```
1063
+
1028
1064
### metrics.global
1029
1065
1030
1066
A [`Stats`](#stats) object of tracking the global bandwidth of the libp2p node.
@@ -1126,21 +1162,23 @@ unless they are performing a specific action. See [peer discovery and auto dial]
1126
1162
1127
1163
-`peer`: instance of [`PeerId`][peer-id]
1128
1164
1165
+
### libp2p.connectionManager
1166
+
1129
1167
#### A new connection to a peer has been opened
1130
1168
1131
1169
This event will be triggered anytime a new Connection is established to another peer.
1132
1170
1133
-
`libp2p.on('peer:connect', (peer) => {})`
1171
+
`libp2p.on('peer:connect', (connection) => {})`
1134
1172
1135
-
-`peer`: instance of [`PeerId`][peer-id]
1173
+
-`connection`: instance of [`Connection`][connection]
1136
1174
1137
1175
#### An existing connection to a peer has been closed
1138
1176
1139
1177
This event will be triggered anytime we are disconnected from another peer, regardless of the circumstances of that disconnection. If we happen to have multiple connections to a peer, this event will **only** be triggered when the last connection is closed.
0 commit comments