Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-06-28 13:49:23 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-06-28 13:49:23 +0300
commitebbffb27127b0856d4a9a59994bbf11ba9269171 (patch)
treee1d8b77c946fe1d4a252e662e13c427adaa47d84 /README.md
parenta71f9a19445c026b6cea320890853ec1e58085bf (diff)
feross's fixes to devTristan pr
explained here: https://github.com/feross/webtorrent/pull/363#issuecomment-116253169
Diffstat (limited to 'README.md')
-rw-r--r--README.md24
1 files changed, 22 insertions, 2 deletions
diff --git a/README.md b/README.md
index 0c4cf68..1fc1169 100644
--- a/README.md
+++ b/README.md
@@ -266,8 +266,7 @@ If `opts` is specified, then the default options (shown below) will be overridde
rtcConfig: Object, // RTCPeerConnection configuration object (default=STUN only)
storage: Function, // custom storage engine, or `false` to use in-memory engine
tracker: Boolean, // Whether or not to enable trackers (default=true)
- wrtc: {}, // custom webrtc implementation (in node, specify the [wrtc](https://www.npmjs.com/package/wrtc) package)
- onWire: Function // function to be called on each new wire. Use this to specify [custom bittorrent extensions](https://www.npmjs.com/package/bittorrent-protocol#extension-api)
+ wrtc: {} // custom webrtc implementation (in node, specify the [wrtc](https://www.npmjs.com/package/wrtc) package)
}
```
@@ -427,6 +426,27 @@ client.add(magnetUri, function (torrent) {
})
```
+#### `torrent.on('wire', function (wire) {})`
+
+Emitted whenever a new peer is connected for this torrent. `wire` is an instance of
+[`bittorrent-protocol`](https://github.com/feross/bittorrent-protocol), which is a
+node.js-style duplex stream to the remote peer. This event can be used to specify
+[custom BitTorrent protocol extensions](https://github.com/feross/bittorrent-protocol#extension-api).
+
+Here is a usage example:
+
+```js
+var MyExtension = require('./my-extension')
+
+torrent1.on('wire', function (wire) {
+ wire.use(MyExtension)
+})
+```
+
+See the `bittorrent-protocol`
+[extension api docs](https://github.com/feross/bittorrent-protocol#extension-api) for more
+information on how to define a protocol extension.
+
### file api
#### `file.name`