Klleon Chat SDK
English
English
  • ✨New Javascript SDK [1.2.0]
    • Getting Started
    • Events
    • UI
    • Methods
      • Life Cycle
      • Text Chat
      • Voice Chat
      • Echo Chat
      • Audio Echo Chat
      • Other
    • TypeScript Support
    • Examples
      • VanillaJS
      • React
      • Nextjs
    • Log System
    • Updates
  • JavaScript SDK [v0.x.x] (Planned for Deprecation)
    • Quick Start
    • Initialize
    • Avatar Streaming
      • Start Streaming
      • Stop Streaming
      • Control Streaming Screen
    • Set Chat Screen
    • Text Message
    • Voice Message
    • Echo - Repeat My Message
    • Event Subscription
    • Updates
  • Service Architecture
Powered by GitBook
LogoLogo

Products

  • Pricing

Websites

  • Homepage
  • Youtube
  • Linkedin

Copyright © Klleon. All rights reserved

On this page
  • Data Information
  • Example
  1. JavaScript SDK [v0.x.x] (Planned for Deprecation)

Event Subscription

Event subscription is a feature to receive event information from the JavaScript SDK.

Event information is in Json format and has the content, time, type, etc. of the message.

It is available with the KlleonChat.onChatEvent() event listener.


Data Information

Name
Type
Description

message

String

Message received from streaming server

chat_type

String

Message type

time

DateTime

Time the message was received

Message Type Name
Description

TEXT

  • Avatar message

  • Start sending video of the avatar speaking

STT_RESULT

User voice message

RATE_LIMIT

Disable receiving avatar message

WAIT

Wait for chat to start

WARN_SUSPENDED

Warning that streaming will stop in 10 seconds if there is no message from user

DISABLED_TIME_OUT

Stop streaming if there is no message from user after a period of time

TEXT_ERROR

Failed to send user message

TEXT_MODERATION

User sends an inappropriate word

ERROR

Server error occurred

RESPONSE_IS_ENDED

End of message from avatar

WORKER_DISCONNECTED

Streaming ended

ACTIVATE_VOICE

Start speech recognition

SHOW_AVATAR

Start avatar streaming screen display

PREPARING_RESPONSE

Preparing avatar response

EXCEED_CONCURRENT_QUOTA

Exceeding the maximum number of concurrent users


Example

<script >
    KlleonChat.onChatEvent((data) => {
        console.log(data);
    });
</script>
{"message":"","chat_type":"PREPARING_RESPONSE","time":"2024-04-05T06:40:27.523350758"}
{"message":"Good to see you!","chat_type":"TEXT","time":"2024-04-05T06:38:02.549614802"}
{"message":"","chat_type":"RESPONSE_IS_ENDED","time":"2024-04-05T06:40:37.08653676"}
...
PreviousEcho - Repeat My MessageNextUpdates

Last updated 5 months ago