-
Notifications
You must be signed in to change notification settings - Fork 95
Conversation
BREAKING CHANGE: Switch to using async/await and async iterators. The transport and connection interfaces have changed.
12af334
to
55fb9ad
Compare
7406a4a
to
2397cf5
Compare
There is a bug for: |
0e0eef2
to
5cf568e
Compare
5cf568e
to
2b6ecbe
Compare
477bec0
to
53870ec
Compare
src/socket-to-conn.js
Outdated
socket.end(err => { | ||
if (err) return reject(err) | ||
maConn.timeline.close = Date.now() | ||
resolve() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar issue to libp2p/js-libp2p-webrtc-direct#30 (comment) with the end
and the close
event code both getting called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed
9c92753
to
d024ed2
Compare
d024ed2
to
0633843
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
BREAKING CHANGE: Switch to using async/await and async iterators. The transport and connection interfaces have changed.
In the context of ipfs/js-ipfs#1670
Depends on:
Interface Transport
dial(ma<Multiaddr>, [options<Object>]): Promise<Connection>
Dial to a peer at the given multiaddr, returns a promise that is resolved when the connection has opened. Throws if connection error or any other error opening the connection, including if the connection is aborted.
The promise resolves to a
Connection
(which is a duplex object) that can be used to communicate with the peer.Options
signal
- anAbortSignal
that can be used to abort the dial. You can obtain one from anAbortController
createListener([options<Object>], [handler<Function<Connection>>]): Listener
Create a new listener, where incoming connections are handled by
handler
. The handler function is called for each new incoming connection. It is passed aConnection
(which is a duplex object). Note the handler param is optional and can be registered later by listening for the 'connected' event.filter(mas<Multiaddr[]>): Multiaddr[]
Filter the multiaddrs this transport can dial.
Events
listening
After the listener has started listening.
connected
For every new connection. The event handler is passed a
Connection
(which is a duplex object).close
After the listener has stopped listening.
Interface Listener
listen(): Promise
getAddrs(): Promise<Multiaddr[]>