Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Matcher

Where Sessions are born.

Implemented by Dialog and DialogOpener on the client side, and ServiceRequest on the service side.

You use this interface to open up a connection to a peer with Poppy I/O. If you're a client this will open up a popup window to host the poppy (or use an already-open window). If you're a poppy service this will connect to the client that opened you.

Hierarchy

  • Matcher

Implemented by

Index

Methods

Methods

match

  • Connect to a peer. This resolves with a Session if something on your matchlist and the peer's match and a connection is established.

    If there isn't a match and it's being called from a client, then it will resolve to nothing. It's not considered an error in that case since it means either ther user cancelled before a poppy could be opened, or a poppy was opened and decided it couldn't fulfill the request, in which case the poppy should have told the that.

    If there isn't a match and you're a service then it does reject, because you really should know better given you get a whole matchlist from the client telling you what they support, it's up to you to figure out whether or not you can handle it. If you can't just tell the user and don't even try to connect.

    Other reasons it may reject are that it was invoked when it shouldn't be (e.g. on an already-connected or closed Dialog) or if the matchlist is invalid. See validateMatchlist for reasons why that would be the case.

    A Matcher may or may not let you use it to connect more than once - Dialogs and ServiceRequests won't, but DialogOpeners will.

    Parameters

    • matchlist: MatchOption | MatchOption[]

      a list of things you want to do, to match against what a peer can do for you.

    Returns Promise<Session | undefined>

Generated using TypeDoc