Function useStartConversation

This hook starts a new conversation and sends an initial message to it.

  • Parameters

    • Optionaloptions: UseStartConversation

    Returns {
        error: null | Error;
        isLoading: boolean;
        startConversation: (<T>(peerAddress: string, content: T, contentType?: ContentTypeId, sendOptions?: SendMessageOptions) => Promise<
            | {
                cachedConversation: undefined;
                cachedMessage: undefined;
                conversation: undefined;
            }
            | {
                cachedConversation: undefined;
                cachedMessage: undefined;
                conversation: Conversation<any>;
            }
            | {
                cachedConversation: CachedConversation<ContentTypeMetadata>;
                cachedMessage: undefined;
                conversation: Conversation<any>;
            }
            | {
                cachedConversation: CachedConversation<ContentTypeMetadata>;
                cachedMessage: CachedMessage<any, ContentTypeMetadata>;
                conversation: Conversation<any>;
            }>);
    }

    • error: null | Error
    • isLoading: boolean
    • startConversation: (<T>(peerAddress: string, content: T, contentType?: ContentTypeId, sendOptions?: SendMessageOptions) => Promise<
          | {
              cachedConversation: undefined;
              cachedMessage: undefined;
              conversation: undefined;
          }
          | {
              cachedConversation: undefined;
              cachedMessage: undefined;
              conversation: Conversation<any>;
          }
          | {
              cachedConversation: CachedConversation<ContentTypeMetadata>;
              cachedMessage: undefined;
              conversation: Conversation<any>;
          }
          | {
              cachedConversation: CachedConversation<ContentTypeMetadata>;
              cachedMessage: CachedMessage<any, ContentTypeMetadata>;
              conversation: Conversation<any>;
          }>)
        • <T>(peerAddress, content, contentType?, sendOptions?): Promise<
              | {
                  cachedConversation: undefined;
                  cachedMessage: undefined;
                  conversation: undefined;
              }
              | {
                  cachedConversation: undefined;
                  cachedMessage: undefined;
                  conversation: Conversation<any>;
              }
              | {
                  cachedConversation: CachedConversation<ContentTypeMetadata>;
                  cachedMessage: undefined;
                  conversation: Conversation<any>;
              }
              | {
                  cachedConversation: CachedConversation<ContentTypeMetadata>;
                  cachedMessage: CachedMessage<any, ContentTypeMetadata>;
                  conversation: Conversation<any>;
              }>
        • Type Parameters

          • T = string

          Parameters

          • peerAddress: string
          • content: T
          • OptionalcontentType: ContentTypeId
          • OptionalsendOptions: SendMessageOptions

          Returns Promise<
              | {
                  cachedConversation: undefined;
                  cachedMessage: undefined;
                  conversation: undefined;
              }
              | {
                  cachedConversation: undefined;
                  cachedMessage: undefined;
                  conversation: Conversation<any>;
              }
              | {
                  cachedConversation: CachedConversation<ContentTypeMetadata>;
                  cachedMessage: undefined;
                  conversation: Conversation<any>;
              }
              | {
                  cachedConversation: CachedConversation<ContentTypeMetadata>;
                  cachedMessage: CachedMessage<any, ContentTypeMetadata>;
                  conversation: Conversation<any>;
              }>