Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/stagas/alice-bob

transport agnostic strongly typed duplex rpc interfaces
https://github.com/stagas/alice-bob

duplex ipc message-passing networking remote-procedure-calls rpc strongly-typed transport-agnostic

Last synced: 13 days ago
JSON representation

transport agnostic strongly typed duplex rpc interfaces

Awesome Lists containing this project

README

        


alice-bob

transport agnostic strongly typed duplex rpc interfaces



npm i alice-bob

pnpm add alice-bob

yarn add alice-bob

## API

# Alice – Alice class. src/alice-bob.ts#L292

# deserializer(data) src/alice-bob.ts#L57

    # data


      unknown


    deserializer(data)  =>


      any

# log(args) – Overridable logging function. Defaults to console.log() and prepends agent.name. src/alice-bob.ts#L63

    # args


      unknown []


    log(args)  =>


      void
# serializer(data) src/alice-bob.ts#L56

    # data


      unknown


    serializer(data)  =>


      any
} & A & {

# target src/alice-bob.ts#L95

} # remote – The remote Agent. src/alice-bob.ts#L99 # agents(local, remote) – Returns the agents tuple [alice, bob]. src/alice-bob.ts#L276


    Example:

    ```ts
    const [alice, bob] = new Alice().agents()

    // to enable debugging on local (alice)
    const [alice, bob] = new Alice().agents({ debug: true })

    // use different names:
    const [alice, bob] = new Alice().agents(
    { name: 'server', debug: true },
    { name: 'client' }
    )
    ```


    # local
    # remote

    agents(local, remote)  =>



# deserializer(data) src/alice-bob.ts#L57

    # data


      unknown


    deserializer(data)  =>


      any
# log(args) – Overridable logging function. Defaults to console.log() and prepends agent.name. src/alice-bob.ts#L63

    # args


      unknown []


    log(args)  =>


      void
# serializer(data) src/alice-bob.ts#L56

    # data


      unknown


    serializer(data)  =>


      any
} & A & {

# target src/alice-bob.ts#L95

}, Agent<B, A> ] # deserializer(data) src/alice-bob.ts#L108

    # data


      any


    deserializer(data)  =>


      any
# serializer(data) src/alice-bob.ts#L107

    # data


      any


    serializer(data)  =>


      any
# AliceBob – AliceBob class. src/alice-bob.ts#L82 # deserializer(data) src/alice-bob.ts#L57

    # data


      unknown


    deserializer(data)  =>


      any
# log(args) – Overridable logging function. Defaults to console.log() and prepends agent.name. src/alice-bob.ts#L63

    # args


      unknown []


    log(args)  =>


      void
# serializer(data) src/alice-bob.ts#L56

    # data


      unknown


    serializer(data)  =>


      any
} & A & {

# target src/alice-bob.ts#L95

} # remote – The remote Agent. src/alice-bob.ts#L99 # agents(local, remote) – Returns the agents tuple [alice, bob]. src/alice-bob.ts#L276


    Example:

    ```ts
    const [alice, bob] = new Alice().agents()

    // to enable debugging on local (alice)
    const [alice, bob] = new Alice().agents({ debug: true })

    // use different names:
    const [alice, bob] = new Alice().agents(
    { name: 'server', debug: true },
    { name: 'client' }
    )
    ```


    # local
    # remote

    agents(local, remote)  =>



# deserializer(data) src/alice-bob.ts#L57

    # data


      unknown


    deserializer(data)  =>


      any
# log(args) – Overridable logging function. Defaults to console.log() and prepends agent.name. src/alice-bob.ts#L63

    # args


      unknown []


    log(args)  =>


      void
# serializer(data) src/alice-bob.ts#L56

    # data


      unknown


    serializer(data)  =>


      any
} & A & {

# target src/alice-bob.ts#L95

}, Agent<B, A> ] # deserializer(data) src/alice-bob.ts#L108

    # data


      any


    deserializer(data)  =>


      any
# serializer(data) src/alice-bob.ts#L107

    # data


      any


    serializer(data)  =>


      any
# Bob – Bob class. src/alice-bob.ts#L313 # deserializer(data) src/alice-bob.ts#L57

    # data


      unknown


    deserializer(data)  =>


      any
# log(args) – Overridable logging function. Defaults to console.log() and prepends agent.name. src/alice-bob.ts#L63

    # args


      unknown []


    log(args)  =>


      void
# serializer(data) src/alice-bob.ts#L56

    # data


      unknown


    serializer(data)  =>


      any
} & A & {

# target src/alice-bob.ts#L95

} # remote – The remote Agent. src/alice-bob.ts#L99 # agents(local, remote) – Returns the agents tuple [alice, bob]. src/alice-bob.ts#L276


    Example:

    ```ts
    const [alice, bob] = new Alice().agents()

    // to enable debugging on local (alice)
    const [alice, bob] = new Alice().agents({ debug: true })

    // use different names:
    const [alice, bob] = new Alice().agents(
    { name: 'server', debug: true },
    { name: 'client' }
    )
    ```


    # local
    # remote

    agents(local, remote)  =>



# deserializer(data) src/alice-bob.ts#L57

    # data


      unknown


    deserializer(data)  =>


      any
# log(args) – Overridable logging function. Defaults to console.log() and prepends agent.name. src/alice-bob.ts#L63

    # args


      unknown []


    log(args)  =>


      void
# serializer(data) src/alice-bob.ts#L56

    # data


      unknown


    serializer(data)  =>


      any
} & A & {

# target src/alice-bob.ts#L95

}, Agent<B, A> ] # deserializer(data) src/alice-bob.ts#L108

    # data


      any


    deserializer(data)  =>


      any
# serializer(data) src/alice-bob.ts#L107

    # data


      any


    serializer(data)  =>


      any
# Payload – Payload. src/alice-bob.ts#L6 # Agent – Agent. src/alice-bob.ts#L28 # deserializer(data) src/alice-bob.ts#L57

    # data


      unknown


    deserializer(data)  =>


      any
# log(args) – Overridable logging function. Defaults to console.log() and prepends agent.name. src/alice-bob.ts#L63

    # args


      unknown []


    log(args)  =>


      void
# serializer(data) src/alice-bob.ts#L56

    # data


      unknown


    serializer(data)  =>


      any
} & A # PayloadMethod src/alice-bob.ts#L21

    # (payload)

      # payload


      (payload)  =>



        Promise<unknown> | unknown

## Contributing

[Fork](https://github.com/stagas/alice-bob/fork) or [edit](https://github.dev/stagas/alice-bob) and submit a PR.

All contributions are welcome!

## License

MIT © 2022 [stagas](https://github.com/stagas)