Skip to content

Commit 68677f3

Browse files
committed
fix: move handler before start
1 parent aa5236a commit 68677f3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/chat/src/listener.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ async function run() {
2222
console.log(peerInfo.id.toB58String())
2323
})
2424

25-
// Start listening
26-
await nodeListener.start()
27-
2825
// Handle messages for the protocol
2926
await nodeListener.handle('/chat/1.0.0', async ({ stream }) => {
3027
// Send stdin to the stream
@@ -33,6 +30,9 @@ async function run() {
3330
streamToConsole(stream)
3431
})
3532

33+
// Start listening
34+
await nodeListener.start()
35+
3636
// Output listen addresses to the console
3737
console.log('Listener ready, listening on:')
3838
peerListener.multiaddrs.forEach((ma) => {

0 commit comments

Comments
 (0)