botkit-starter-web icon indicating copy to clipboard operation
botkit-starter-web copied to clipboard

An error occurred when use_sockets is set to false

Open msjaber opened this issue 7 years ago • 3 comments

Whenever use_sockets in client.js file is disabled, this error occurs.

An error occurred while sending a message: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client

msjaber avatar Feb 13 '18 21:02 msjaber

You are trying to send two replies or convos through a webhook

On Feb 13, 2018 22:09, "Mohammad S. Jaber" [email protected] wrote:

Whenever use_sockets is client.js file is disabled, this error occurs.

An error occurred while sending a message: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/howdyai/botkit-starter-web/issues/27, or mute the thread https://github.com/notifications/unsubscribe-auth/AJnCY4fiIbtc8sEy_JrvRJWgc2KTkN1Aks5tUfohgaJpZM4SEZ1X .

adantoscano avatar Feb 14 '18 07:02 adantoscano

@adantoscano Hmm... I only changed use_socket to false and didn't try to reply anything. Try to Remix it on Glitch and see.

msjaber avatar Feb 14 '18 08:02 msjaber

Yup but if you keep socket as true, you can see that you receive two messages cause skills/need_token.js is triggered when it starts. Changing socket to false you're using webhook and with it cannot perform more than a reply each input.

See https://github.com/howdyai/botkit-starter-web/blob/master/docs/botkit_chat_server.md#using-webhooks

adantoscano avatar Feb 14 '18 09:02 adantoscano