From 1bb1f8f6b627ab3353d1220c91634757a5af6726 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Wed, 9 Jun 2021 16:58:08 +1000 Subject: [PATCH 1/2] Use tcp protocol only Due to #201, Websocket protocol is not added by default if the caller specifies a protocol for libp2p. In the case cli-chat. We were using both tcp and ws. As the web-chat already demonstrates usage of websocket protocol, we cli-chat to tcp only. --- CHANGELOG.md | 3 ++- examples/cli-chat/src/chat.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a25e95883..d0693ae2f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - **Breaking**: Options passed to `Waku.create` used to be passed to `Libp2p.create`; - Now, only the `libp2p` property is passed to `Libp2p.create`, allowing for a cleaner interface. + Now, only the `libp2p` property is passed to `Libp2p.create`, allowing for a cleaner interface. +- Examples (cli chat): Use tcp protocol instead of websocket. ### Added - Enable access to `WakuMessage.timestamp`. diff --git a/examples/cli-chat/src/chat.ts b/examples/cli-chat/src/chat.ts index 0f29881e73..b399d84134 100644 --- a/examples/cli-chat/src/chat.ts +++ b/examples/cli-chat/src/chat.ts @@ -7,6 +7,7 @@ import { Environment, getStatusFleetNodes, LightPushCodec, + Protocol, StoreCodec, Waku, WakuMessage, @@ -202,7 +203,8 @@ export function formatMessage(chatMsg: ChatMessage): string { async function addFleetNodes(opts: Options): Promise { await getStatusFleetNodes( - opts.prod ? Environment.Prod : Environment.Test + opts.prod ? Environment.Prod : Environment.Test, + Protocol.tcp ).then((nodes) => nodes.map((addr) => { opts.staticNodes.push(multiaddr(addr)); From 2350ce5a6fe040b3f582d510babfd9ba4ff7271f Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Wed, 9 Jun 2021 16:59:27 +1000 Subject: [PATCH 2/2] Clarify new libp2p modules transport behaviour --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0693ae2f8..e1d66a840e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Changed +- **Breaking**: Websocket protocol is not automatically added anymore if the user specifies a protocol in `libp2p.modules` + when using `Waku.create`. - **Breaking**: Options passed to `Waku.create` used to be passed to `Libp2p.create`; Now, only the `libp2p` property is passed to `Libp2p.create`, allowing for a cleaner interface. - Examples (cli chat): Use tcp protocol instead of websocket.