Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Waku relay (node): chat app example #15

Closed
3 tasks done
D4nte opened this issue Mar 28, 2021 · 10 comments · Fixed by #9
Closed
3 tasks done

Waku relay (node): chat app example #15

D4nte opened this issue Mar 28, 2021 · 10 comments · Fixed by #9
Labels
enhancement New feature or request

Comments

@D4nte
Copy link
Contributor

D4nte commented Mar 28, 2021

Problem

Demonstrate the usage of the js-waku relay API in a real example.

Solution

Build a terminal chat app compatible with the nim-waky chat2 example app.

Acceptance Criteria

Able to send and receive messages from the fleet using said app.

Steps

@D4nte D4nte added this to the waku-relay (node) milestone Mar 28, 2021
This was referenced Mar 28, 2021
@D4nte
Copy link
Contributor Author

D4nte commented Mar 28, 2021

Current status (#9):

  • Can send messages to the fleet (js-chat(local)>nim-waku(fleet)>nim-chat2(local).
  • Issue receiving messages from the fleet: It works sporadically. Up starting the app, it either work or does not which points that the issue must be around the starting routine. Probably link to timing between connecting to a node and subscribing to the topic.

Next steps:

  • investigate the sporadic reception of messages.

@D4nte
Copy link
Contributor Author

D4nte commented Mar 29, 2021

@jm-clius Could you please clarify how you encode the date and username in the chat messages?

@D4nte
Copy link
Contributor Author

D4nte commented Mar 29, 2021

  • Attempted to improve the lib to auto-subscribe but it became cumbersome to get tests to pass so opened waku relay API: auto-subscribe #17 to do later.
  • Tried to start a local nim-waku node to investigate why chat app does not always receive messages. However getting the error below upon starting the node, currently pulling latest master to see a if it's fixed.
  • looking in adding command line arguments to not hardcore peer's multiaddress
TRC 2021-03-29 16:04:21.081+11:00 reading first requested proto              topics="libp2p multistream" tid=4056092 file=multistream.nim:74 conn=16U*o97bUZ:60615fd417a3331e18013388
TRC 2021-03-29 16:04:21.081+11:00 successfully selected                      topics="libp2p multistream" tid=4056092 file=multistream.nim:76 conn=16U*o97bUZ:60615fd417a3331e18013388 proto=/vac/waku/relay/2.0.0-beta2
INF 2021-03-29 16:04:21.081+11:00 Post peerManager dial                      topics="wakunode" tid=4056092 file=wakunode2.nim:417
INF 2021-03-29 16:04:26.085+11:00 dialPeer                                   topics="wakunode" tid=4056092 file=wakunode2.nim:420 address=/ip4/134.209.139.210/tcp/30303/p2p/16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ
libbacktrace error: no debugging symbols available. Compile with '--debugger:native'.
Traceback (most recent call last, using override)
/home/froyer/src/status-im/nim-waku/waku/v2/node/wakunode2.nim(568) wakunode2
/home/froyer/src/status-im/nim-waku/waku/v2/node/wakunode2.nim(424) setStorePeer
/home/froyer/src/status-im/nim-waku/waku/v2/protocol/waku_store/waku_store.nim(364) setPeer
/home/froyer/src/status-im/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/excpt.nim(610) signalHandler
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
DBG 2021-03-29 16:04:28.186+11:00 UPnP: deleted port mapping                 topics="nat" tid=4056092 file=nat.nim:212 externalPort=60000 internalPort=60000 protocol=TCP
DBG 2021-03-29 16:04:28.196+11:00 UPnP: deleted port mapping                 topics="nat" tid=4056092 file=nat.nim:212 externalPort=60000 internalPort=60000 protocol=UDP

@D4nte
Copy link
Contributor Author

D4nte commented Mar 29, 2021

Issue reported with nim-waku: waku-org/nwaku#439

@D4nte
Copy link
Contributor Author

D4nte commented Mar 29, 2021

Looks like the issue is indeed timing related: 9a5acdc

@D4nte
Copy link
Contributor Author

D4nte commented Mar 29, 2021

when looking at libp2p.pubsub.peers before and after the sleep, we can see that the outboundStream is not yet set.

Map(1) {
  '16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ' => PeerStreams {
    _events: [Object: null prototype] { close: [Function] },
    _eventsCount: 1,
    _maxListeners: undefined,
    id: PeerId {
      _id: [Uint8Array],
      _idB58String: '16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ',
      _privKey: null,
      _pubKey: [Secp256k1PublicKey]
    },
    protocol: '/vac/waku/relay/2.0.0-beta2',
    _rawOutboundStream: null,
    _rawInboundStream: {
      close: [Function: close],
      abort: [Function: abort],
      reset: [Function: reset],
      sink: [Function: sink],
      source: Object [AsyncGenerator] {},
      timeline: [Object],
      id: 'r1'
    },
    _inboundAbortController: AbortController {},
    outboundStream: null,
    inboundStream: Object [AsyncGenerator] {},
    [Symbol(kCapture)]: false
  }
}
Map(1) {
  '16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ' => PeerStreams {
    _events: [Object: null prototype] { close: [Function] },
    _eventsCount: 1,
    _maxListeners: undefined,
    id: PeerId {
      _id: [Uint8Array],
      _idB58String: '16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ',
      _privKey: null,
      _pubKey: [Secp256k1PublicKey]
    },
    protocol: '/vac/waku/relay/2.0.0-beta2',
    _rawOutboundStream: {
      close: [Function: close],
      abort: [Function: abort],
      reset: [Function: reset],
      sink: [Function: sink],
      source: Object [AsyncGenerator] {},
      timeline: [Object],
      id: 'i2'
    },
    _rawInboundStream: {
      close: [Function: close],
      abort: [Function: abort],
      reset: [Function: reset],
      sink: [Function: sink],
      source: Object [AsyncGenerator] {},
      timeline: [Object],
      id: 'r1'
    },
    _inboundAbortController: AbortController {},
    outboundStream: {
      next: [Function: next],
      throw: [Function: throw],
      return: [Function: return],
      push: [Function: push],
      end: [Function: end],
      [Symbol(Symbol.asyncIterator)]: [Function: [Symbol.asyncIterator]]
    },
    inboundStream: Object [AsyncGenerator] {},
    [Symbol(kCapture)]: false
  }
}

@D4nte
Copy link
Contributor Author

D4nte commented Mar 29, 2021

The sleep helped for a while but does not anymore. State of libp2p when it does not work:

<ref *2> Libp2p {
  _events: [Object: null prototype] {},
  _eventsCount: 0,
  _maxListeners: undefined,
  _options: {
    addresses: { listen: [Array], announce: [], noAnnounce: [] },
    connectionManager: { minConnections: 25 },
    transportManager: { faultTolerance: 0 },
    dialer: {
      maxParallelDials: 100,
      maxDialsPerPeer: 4,
      dialTimeout: 30000,
      resolvers: [Object],
      addressSorter: [Function: publicAddressesFirst]
    },
    host: { agentVersion: 'js-libp2p/0.30.10' },
    metrics: { enabled: false },
    peerStore: { persistence: false, threshold: 5 },
    peerRouting: { refreshManager: [Object] },
    config: {
      dht: [Object],
      nat: [Object],
      peerDiscovery: [Object],
      pubsub: [Object],
      relay: [Object],
      transport: {}
    },
    modules: {
      transport: [Array],
      streamMuxer: [Array],
      connEncryption: [Array],
      pubsub: [class WakuRelayPubsub extends Gossipsub]
    },
    peerId: PeerId {
      _id: [Uint8Array],
      _idB58String: 'Qmd9nTE65ZBGEyaPg7TdSyyFqB1pA7chLXbKbAtgJPhTmF',
      _privKey: [RsaPrivateKey],
      _pubKey: [RsaPublicKey],
      _idCIDString: 'bafzbeig4c2v2qttqhkshg762cthclkzdnm7xvxcnslq5uupdoyv6qxfffy'
    }
  },
  peerId: PeerId {
    _id: Uint8Array(34) [
       18,  32, 220,  22, 171, 168,  78, 112,
       58, 164, 115, 127, 218,  20, 206,  37,
      171,  35, 107,  63, 122, 220,  77, 146,
      225, 218,  81, 227, 118,  43, 232,  92,
      165,  46
    ],
    _idB58String: 'Qmd9nTE65ZBGEyaPg7TdSyyFqB1pA7chLXbKbAtgJPhTmF',
    _privKey: RsaPrivateKey { _key: [Object], _publicKey: [Object] },
    _pubKey: RsaPublicKey { _key: [Object] },
    _idCIDString: 'bafzbeig4c2v2qttqhkshg762cthclkzdnm7xvxcnslq5uupdoyv6qxfffy'
  },
  datastore: undefined,
  peerStore: <ref *1> PeerStore {
    _events: [Object: null prototype] {
      'change:multiaddrs': [Function (anonymous)],
      'change:protocols': [Array],
      peer: [Function (anonymous)]
    },
    _eventsCount: 3,
    _maxListeners: undefined,
    _peerId: PeerId {
      _id: [Uint8Array],
      _idB58String: 'Qmd9nTE65ZBGEyaPg7TdSyyFqB1pA7chLXbKbAtgJPhTmF',
      _privKey: [RsaPrivateKey],
      _pubKey: [RsaPublicKey],
      _idCIDString: 'bafzbeig4c2v2qttqhkshg762cthclkzdnm7xvxcnslq5uupdoyv6qxfffy'
    },
    addressBook: AddressBook {
      _ps: [Circular *1],
      eventName: 'change:multiaddrs',
      eventProperty: 'multiaddrs',
      eventTransformer: [Function: eventTransformer],
      data: [Map]
    },
    keyBook: KeyBook {
      _ps: [Circular *1],
      eventName: 'change:pubkey',
      eventProperty: 'pubkey',
      eventTransformer: [Function: eventTransformer],
      data: [Map]
    },
    metadataBook: MetadataBook {
      _ps: [Circular *1],
      eventName: 'change:metadata',
      eventProperty: 'metadata',
      eventTransformer: [Function: passthrough],
      data: [Map]
    },
    protoBook: ProtoBook {
      _ps: [Circular *1],
      eventName: 'change:protocols',
      eventProperty: 'protocols',
      eventTransformer: [Function: eventTransformer],
      data: [Map]
    },
    [Symbol(kCapture)]: false
  },
  addresses: {
    listen: [ '/ip4/0.0.0.0/tcp/55123' ],
    announce: [],
    noAnnounce: []
  },
  addressManager: AddressManager {
    _events: [Object: null prototype] {
      'change:addresses': [Function (anonymous)]
    },
    _eventsCount: 1,
    _maxListeners: undefined,
    peerId: PeerId {
      _id: [Uint8Array],
      _idB58String: 'Qmd9nTE65ZBGEyaPg7TdSyyFqB1pA7chLXbKbAtgJPhTmF',
      _privKey: [RsaPrivateKey],
      _pubKey: [RsaPublicKey],
      _idCIDString: 'bafzbeig4c2v2qttqhkshg762cthclkzdnm7xvxcnslq5uupdoyv6qxfffy'
    },
    listen: Set(1) { '/ip4/0.0.0.0/tcp/55123' },
    announce: Set(0) {},
    observed: Set(0) {},
    [Symbol(kCapture)]: false
  },
  _modules: {
    transport: [ [Function] ],
    streamMuxer: [ [Function] ],
    connEncryption: [ [Noise] ],
    pubsub: [class WakuRelayPubsub extends Gossipsub]
  },
  _config: {
    dht: { enabled: false, kBucketSize: 20, randomWalk: [Object] },
    nat: {
      enabled: true,
      ttl: 7200,
      keepAlive: true,
      gateway: null,
      externalIp: null,
      pmp: [Object]
    },
    peerDiscovery: { autoDial: true },
    pubsub: { enabled: true },
    relay: {
      enabled: true,
      advertise: [Object],
      hop: [Object],
      autoRelay: [Object]
    },
    transport: {}
  },
  _transport: [],
  _discovery: Map(0) {},
  connectionManager: ConnectionManager {
    _events: [Object: null prototype] {
      'peer:disconnect': [Function: bound _onDisconnect],
      'peer:connect': [Array]
    },
    _eventsCount: 2,
    _maxListeners: undefined,
    _libp2p: [Circular *2],
    _peerId: 'Qmd9nTE65ZBGEyaPg7TdSyyFqB1pA7chLXbKbAtgJPhTmF',
    _options: {
      maxConnections: Infinity,
      minConnections: 25,
      maxData: Infinity,
      maxSentData: Infinity,
      maxReceivedData: Infinity,
      maxEventLoopDelay: Infinity,
      pollInterval: 2000,
      autoDialInterval: 10000,
      movingAverageInterval: 60000,
      defaultPeerValue: 1,
      autoDial: true
    },
    _peerValues: Map(1) {
      '16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ' => 1
    },
    connections: Map(1) {
      '16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ' => [Array]
    },
    _started: true,
    _timer: null,
    _autoDialTimeout: Retimer {
      _started: 382512047,
      _rescheduled: 0,
      _scheduled: 10000,
      _args: [],
      _timer: Timeout {
        _idleTimeout: 10000,
        _idlePrev: [TimersList],
        _idleNext: [TimersList],
        _idleStart: 4909,
        _onTimeout: [Function: timerWrapper],
        _timerArgs: undefined,
        _repeat: null,
        _destroyed: false,
        [Symbol(refed)]: true,
        [Symbol(kHasPrimitive)]: false,
        [Symbol(asyncId)]: 26,
        [Symbol(triggerId)]: 0
      }
    },
    _checkMetrics: [Function: bound _checkMetrics],
    _autoDial: [Function: bound _autoDial] AsyncFunction,
    _latencyMonitor: LatencyMonitor {
      _events: [Object: null prototype],
      _eventsCount: 1,
      _maxListeners: undefined,
      latencyCheckIntervalMs: 2000,
      latencyRandomPercentage: 10,
      _latecyCheckMultiply: 400,
      _latecyCheckSubtract: 200,
      dataEmitIntervalMs: 2000,
      asyncTestFn: undefined,
      now: [Function],
      getDeltaMS: [Function (anonymous)],
      _latencyData: [Object],
      _checkLatencyID: Timeout {
        _idleTimeout: 2065,
        _idlePrev: [TimersList],
        _idleNext: [TimersList],
        _idleStart: 9191,
        _onTimeout: [Function (anonymous)],
        _timerArgs: undefined,
        _repeat: null,
        _destroyed: false,
        [Symbol(refed)]: false,
        [Symbol(kHasPrimitive)]: false,
        [Symbol(asyncId)]: 74,
        [Symbol(triggerId)]: 53
      },
      _emitIntervalID: Timeout {
        _idleTimeout: 2000,
        _idlePrev: [TimersList],
        _idleNext: [TimersList],
        _idleStart: 10909,
        _onTimeout: [Function (anonymous)],
        _timerArgs: undefined,
        _repeat: 2000,
        _destroyed: false,
        [Symbol(refed)]: false,
        [Symbol(kHasPrimitive)]: false,
        [Symbol(asyncId)]: 25,
        [Symbol(triggerId)]: 0
      },
      [Symbol(kCapture)]: false
    },
    _onLatencyMeasure: [Function: bound _onLatencyMeasure],
    [Symbol(kCapture)]: false
  },
  upgrader: Upgrader {
    localPeer: PeerId {
      _id: [Uint8Array],
      _idB58String: 'Qmd9nTE65ZBGEyaPg7TdSyyFqB1pA7chLXbKbAtgJPhTmF',
      _privKey: [RsaPrivateKey],
      _pubKey: [RsaPublicKey],
      _idCIDString: 'bafzbeig4c2v2qttqhkshg762cthclkzdnm7xvxcnslq5uupdoyv6qxfffy'
    },
    metrics: undefined,
    cryptos: Map(1) { '/noise' => [Noise] },
    muxers: Map(1) { '/mplex/6.7.0' => [Function] },
    protector: null,
    protocols: Map(5) {
      '/libp2p/circuit/relay/0.1.0' => [Function: bound _onProtocol] AsyncFunction,
      '/ipfs/id/1.0.0' => [Function: bound handleMessage],
      '/ipfs/id/push/1.0.0' => [Function: bound handleMessage],
      '/ipfs/ping/1.0.0' => [Function (anonymous)],
      '/vac/waku/relay/2.0.0-beta2' => [Function: bound _onIncomingStream]
    },
    onConnection: [Function: onConnection],
    onConnectionEnd: [Function: onConnectionEnd]
  },
  transportManager: TransportManager {
    libp2p: [Circular *2],
    upgrader: Upgrader {
      localPeer: [PeerId],
      metrics: undefined,
      cryptos: [Map],
      muxers: [Map],
      protector: null,
      protocols: [Map],
      onConnection: [Function: onConnection],
      onConnectionEnd: [Function: onConnectionEnd]
    },
    _transports: Map(2) { 'TCP' => [TCP], 'Circuit' => [Circuit] },
    _listeners: Map(2) { 'TCP' => [Array], 'Circuit' => [] },
    _listenerOptions: Map(2) { 'TCP' => {}, 'Circuit' => {} },
    faultTolerance: 0
  },
  natManager: NatManager {
    _peerId: PeerId {
      _id: [Uint8Array],
      _idB58String: 'Qmd9nTE65ZBGEyaPg7TdSyyFqB1pA7chLXbKbAtgJPhTmF',
      _privKey: [RsaPrivateKey],
      _pubKey: [RsaPublicKey],
      _idCIDString: 'bafzbeig4c2v2qttqhkshg762cthclkzdnm7xvxcnslq5uupdoyv6qxfffy'
    },
    _addressManager: AddressManager {
      _events: [Object: null prototype],
      _eventsCount: 1,
      _maxListeners: undefined,
      peerId: [PeerId],
      listen: [Set],
      announce: Set(0) {},
      observed: Set(0) {},
      [Symbol(kCapture)]: false
    },
    _transportManager: TransportManager {
      libp2p: [Circular *2],
      upgrader: [Upgrader],
      _transports: [Map],
      _listeners: [Map],
      _listenerOptions: [Map],
      faultTolerance: 0
    },
    _enabled: true,
    _externalIp: null,
    _options: {
      description: 'libp2p@0.30.10 bafzbeig4c2v2qttqhkshg762cthclkzdnm7xvxcnslq5uupdoyv6qxfffy',
      ttl: 7200,
      autoUpdate: true,
      gateway: null,
      enablePMP: false
    }
  },
  registrar: Registrar {
    peerStore: <ref *1> PeerStore {
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      _peerId: [PeerId],
      addressBook: [AddressBook],
      keyBook: [KeyBook],
      metadataBook: [MetadataBook],
      protoBook: [ProtoBook],
      [Symbol(kCapture)]: false
    },
    connectionManager: ConnectionManager {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      _libp2p: [Circular *2],
      _peerId: 'Qmd9nTE65ZBGEyaPg7TdSyyFqB1pA7chLXbKbAtgJPhTmF',
      _options: [Object],
      _peerValues: [Map],
      connections: [Map],
      _started: true,
      _timer: null,
      _autoDialTimeout: [Retimer],
      _checkMetrics: [Function: bound _checkMetrics],
      _autoDial: [Function: bound _autoDial] AsyncFunction,
      _latencyMonitor: [LatencyMonitor],
      _onLatencyMeasure: [Function: bound _onLatencyMeasure],
      [Symbol(kCapture)]: false
    },
    topologies: Map(1) { '37wpep.jl8cp1616999472474' => [MulticodecTopology] },
    _handle: [Function: bound handle],
    _onDisconnect: [Function: bound _onDisconnect]
  },
  handle: [Function: bound handle],
  dialer: Dialer {
    transportManager: TransportManager {
      libp2p: [Circular *2],
      upgrader: [Upgrader],
      _transports: [Map],
      _listeners: [Map],
      _listenerOptions: [Map],
      faultTolerance: 0
    },
    peerStore: <ref *1> PeerStore {
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      _peerId: [PeerId],
      addressBook: [AddressBook],
      keyBook: [KeyBook],
      metadataBook: [MetadataBook],
      protoBook: [ProtoBook],
      [Symbol(kCapture)]: false
    },
    addressSorter: [Function: publicAddressesFirst],
    concurrency: 100,
    timeout: 30000,
    perPeerLimit: 4,
    tokens: [
       1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12,
      13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
      25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
      37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
      49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
      61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
      73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
      85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
      97, 98, 99,  0
    ],
    _pendingDials: Map(0) {}
  },
  relay: Relay {
    _libp2p: [Circular *2],
    _options: {
      advertise: [Object],
      enabled: true,
      hop: [Object],
      autoRelay: [Object]
    },
    _autoRelay: false,
    _advertiseService: [Function: bound _advertiseService] AsyncFunction
  },
  identifyService: IdentifyService {
    _libp2p: [Circular *2],
    peerStore: <ref *1> PeerStore {
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      _peerId: [PeerId],
      addressBook: [AddressBook],
      keyBook: [KeyBook],
      metadataBook: [MetadataBook],
      protoBook: [ProtoBook],
      [Symbol(kCapture)]: false
    },
    addressManager: AddressManager {
      _events: [Object: null prototype],
      _eventsCount: 1,
      _maxListeners: undefined,
      peerId: [PeerId],
      listen: [Set],
      announce: Set(0) {},
      observed: Set(0) {},
      [Symbol(kCapture)]: false
    },
    connectionManager: ConnectionManager {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      _libp2p: [Circular *2],
      _peerId: 'Qmd9nTE65ZBGEyaPg7TdSyyFqB1pA7chLXbKbAtgJPhTmF',
      _options: [Object],
      _peerValues: [Map],
      connections: [Map],
      _started: true,
      _timer: null,
      _autoDialTimeout: [Retimer],
      _checkMetrics: [Function: bound _checkMetrics],
      _autoDial: [Function: bound _autoDial] AsyncFunction,
      _latencyMonitor: [LatencyMonitor],
      _onLatencyMeasure: [Function: bound _onLatencyMeasure],
      [Symbol(kCapture)]: false
    },
    peerId: PeerId {
      _id: [Uint8Array],
      _idB58String: 'Qmd9nTE65ZBGEyaPg7TdSyyFqB1pA7chLXbKbAtgJPhTmF',
      _privKey: [RsaPrivateKey],
      _pubKey: [RsaPublicKey],
      _idCIDString: 'bafzbeig4c2v2qttqhkshg762cthclkzdnm7xvxcnslq5uupdoyv6qxfffy'
    },
    handleMessage: [Function: bound handleMessage],
    _host: {
      agentVersion: 'js-libp2p/0.30.10',
      protocolVersion: 'ipfs/0.1.0'
    }
  },
  pubsub: <ref *3> WakuRelayPubsub {
    _events: [Object: null prototype] {
      '/waku/2/default-waku/proto': [Function (anonymous)]
    },
    _eventsCount: 1,
    _maxListeners: undefined,
    log: [Function: debug] {
      namespace: 'libp2p:gossipsub',
      useColors: false,
      color: 6,
      extend: [Function: extend],
      destroy: [Function: deprecated],
      enabled: [Getter/Setter],
      inspectOpts: {},
      err: [Function],
      diff: 2892,
      prev: 1616999475689,
      curr: 1616999478581
    },
    multicodecs: [ '/vac/waku/relay/2.0.0-beta2' ],
    _libp2p: [Circular *2],
    registrar: Registrar {
      peerStore: [PeerStore],
      connectionManager: [ConnectionManager],
      topologies: [Map],
      _handle: [Function: bound handle],
      _onDisconnect: [Function: bound _onDisconnect]
    },
    peerId: PeerId {
      _id: [Uint8Array],
      _idB58String: 'Qmd9nTE65ZBGEyaPg7TdSyyFqB1pA7chLXbKbAtgJPhTmF',
      _privKey: [RsaPrivateKey],
      _pubKey: [RsaPublicKey],
      _idCIDString: 'bafzbeig4c2v2qttqhkshg762cthclkzdnm7xvxcnslq5uupdoyv6qxfffy'
    },
    started: true,
    topics: Map(1) { '/waku/2/default-waku/proto' => [Set] },
    subscriptions: Set(1) { '/waku/2/default-waku/proto' },
    peers: Map(1) {
      '16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ' => [PeerStreams]
    },
    globalSignaturePolicy: 'StrictNoSign',
    canRelayMessage: false,
    emitSelf: false,
    topicValidators: Map(0) {},
    _registrarId: '37wpep.jl8cp1616999472474',
    _onIncomingStream: [Function: bound _onIncomingStream],
    _onPeerConnected: [Function: bound _onPeerConnected] AsyncFunction,
    _onPeerDisconnected: [Function: bound _onPeerDisconnected],
    _options: {
      gossipIncoming: true,
      fallbackToFloodsub: true,
      floodPublish: true,
      doPX: false,
      directPeers: [],
      D: 6,
      Dlo: 4,
      Dhi: 12,
      Dscore: 4,
      Dout: 2,
      Dlazy: 6,
      emitSelf: false,
      globalSignaturePolicy: 'StrictNoSign',
      scoreParams: [Object],
      scoreThresholds: [Object]
    },
    direct: Set(0) {},
    seenCache: TimeCache {
      put: [Function (anonymous)],
      get: [Function (anonymous)],
      has: [Function (anonymous)]
    },
    mesh: Map(1) { '/waku/2/default-waku/proto' => [Set] },
    fanout: Map(0) {},
    lastpub: Map(0) {},
    gossip: Map(0) {},
    control: Map(0) {},
    peerhave: Map(0) {},
    iasked: Map(0) {},
    backoff: Map(0) {},
    outbound: Map(1) {
      '16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ' => true
    },
    messageCache: MessageCache {
      msgs: Map(0) {},
      peertx: Map(0) {},
      history: [Array],
      gossip: 3,
      msgIdFn: [Function: bound getMsgId]
    },
    heartbeat: Heartbeat { gossipsub: [Circular *3], _heartbeatTimer: [Object] },
    heartbeatTicks: 7,
    gossipTracer: IWantTracer {
      getMsgId: [Function: bound getMsgId],
      promises: Map(0) {}
    },
    score: PeerScore {
      params: [Object],
      _connectionManager: [ConnectionManager],
      peerStats: [Map],
      peerIPs: [Map],
      deliveryRecords: [MessageDeliveries],
      msgId: [Function: bound getMsgId],
      _backgroundInterval: Timeout {
        _idleTimeout: 1000,
        _idlePrev: [Timeout],
        _idleNext: [TimersList],
        _idleStart: 10910,
        _onTimeout: [Function (anonymous)],
        _timerArgs: undefined,
        _repeat: 1000,
        _destroyed: false,
        [Symbol(refed)]: true,
        [Symbol(kHasPrimitive)]: false,
        [Symbol(asyncId)]: 22,
        [Symbol(triggerId)]: 0
      }
    },
    _subscribeAdapter: [Function: subscribe],
    _unsubscribeAdapter: [Function: unsubscribe],
    subscribe: [Function: subscribe],
    unsubscribe: [Function: unsubscribe],
    _directPeerInitial: Timeout {
      _idleTimeout: 1000,
      _idlePrev: null,
      _idleNext: null,
      _idleStart: 4908,
      _onTimeout: [Function (anonymous)],
      _timerArgs: undefined,
      _repeat: null,
      _destroyed: true,
      [Symbol(refed)]: true,
      [Symbol(kHasPrimitive)]: false,
      [Symbol(asyncId)]: 23,
      [Symbol(triggerId)]: 0
    },
    [Symbol(kCapture)]: false
  },
  peerRouting: PeerRouting {
    _peerId: PeerId {
      _id: [Uint8Array],
      _idB58String: 'Qmd9nTE65ZBGEyaPg7TdSyyFqB1pA7chLXbKbAtgJPhTmF',
      _privKey: [RsaPrivateKey],
      _pubKey: [RsaPublicKey],
      _idCIDString: 'bafzbeig4c2v2qttqhkshg762cthclkzdnm7xvxcnslq5uupdoyv6qxfffy'
    },
    _peerStore: <ref *1> PeerStore {
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      _peerId: [PeerId],
      addressBook: [AddressBook],
      keyBook: [KeyBook],
      metadataBook: [MetadataBook],
      protoBook: [ProtoBook],
      [Symbol(kCapture)]: false
    },
    _routers: [],
    _refreshManagerOptions: { enabled: true, interval: 600000, bootDelay: 10000 },
    _findClosestPeersTask: [Function: bound _findClosestPeersTask] AsyncFunction
  },
  contentRouting: ContentRouting { libp2p: [Circular *2], routers: [], dht: undefined },
  _onDiscoveryPeer: [Function: bound _onDiscoveryPeer],
  _isStarted: true,
  [Symbol(kCapture)]: false
}

@jm-clius
Copy link

jm-clius commented Mar 29, 2021

@jm-clius Could you please clarify how you encode the date and username in the chat messages?

Absolutely. Now that more than one Waku implementation will read chat2 messages, I'll properly document the protobuf format.

@D4nte
Copy link
Contributor Author

D4nte commented Mar 29, 2021

Made of aware of some possible dial/subscribe timing issue on nim-waku. Using test suite to pin down the issue. It looks like the timing issues are actually on js side as when the dial promise is finished, the peers are not always present, meaning the subscribe does not happen (as there are no peers).

@D4nte
Copy link
Contributor Author

D4nte commented Mar 30, 2021

Made of aware of some possible dial/subscribe timing issue on nim-waku. Using test suite to pin down the issue. It looks like the timing issues are actually on js side as when the dial promise is finished, the peers are not always present, meaning the subscribe does not happen (as there are no peers).

Issue open to clarify expected behaviour: waku-org/nwaku#443

@D4nte D4nte changed the title Waku-relay (node): chat app example Waku relay (node): chat app example Mar 31, 2021
@D4nte D4nte added enhancement New feature or request waku relay labels Apr 1, 2021
@bors bors bot closed this as completed in 62b27fd Apr 1, 2021
@bors bors bot closed this as completed in #9 Apr 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants