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

how to connect to a chat from server side for Bot app? #1150

Open
dcsan opened this issue Jul 31, 2023 · 0 comments
Open

how to connect to a chat from server side for Bot app? #1150

dcsan opened this issue Jul 31, 2023 · 0 comments

Comments

@dcsan
Copy link

dcsan commented Jul 31, 2023

how do i connect to a chat from server side to implement a bot? I want to listen/read and send/write messages.

I tried this

    await chatClient.connectUser(
      {
        id: AppConfig.ADMIN_BOT_ID,
        allowServerSideConnect: true,
      },
      userToken
    );

but get a warning

Please do not use connectUser server side. connectUser impacts MAU and concurrent connection usage and thus your bill. If you have a valid use-case, add "allowServerSideConnect: true" to the client options to disable this warning.

is this the wrong way to do a server side connection? It seems to work.
how do I add to the 'client options' ?

If I don't connectUser I get this error:

Error: StreamChat error code 4: QueryChannels failed with error: "Watch or ChatPresence requires an active websocket connection, please make sure to include your websocket connection_id"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant