Skip to main content

User attempted start session

This function is triggered when a user attempts to connect to ChatKitty, starting a new user session. Inside this function you can define custom logic to authenticate the user, check their credentials, create the user's ChatKitty profile or hook into your own backend.

async function handleEvent(event: UserAttemptedStartSessionEvent, context: Context) {
}

The above function takes two parameters:

  1. The event object which in this case is the UserAttemptedStartSessionEvent object. This object has two properties:

    • username: A string of the username of the user attempting to start a session.
    • authParams: Authentication parameters provided to help determine if a user should be authenticated. These are any authentication parameters you include client-side using the authParams property.
  2. A Context object.

note

This is a blocking chat function.