Skip to content

Connection event seems to trigger sync #29

@topaxi

Description

@topaxi

Given something like:

  let srv = Mitm()
  let client = irc.Client.create({
    host: 'irc.example.com',
    port: 6667,
    nick: 'topaxi',
    user: 'topaxi'
  })
  let subscription = client.subscribe()

  srv.on('connection', () => {
    subscription.unsubscribe()
    srv.disable()
    done()
  })

The subscription will be undefined in the connection event, this makes it kinda hard to write tests without introducing manual process.nextTick(...) calls.
I've tried putting the subscribe() call below the 'connection' event, but this won't work as connection will be triggered inside my subscribe call (because Mitm seems to make this sync).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions