Skip to content

Add handling of kick reasons #1654

@floriankilian

Description

@floriankilian

Currently the kickClient method only sends a generic "Kicked from game (you may have been playing on another tab)" message for all kick scenarios. We need to differentiate between different kick reasons:

  • Kicked by admin - needs specific error message
  • Kicked by private lobby creator - introduced in Private Lobbies: Add kick player functionality #1436, needs specific message
  • Kicked due to multi-tabbing - current default message
  • Default fallback - possibly same message as multi-tabbing message

Current implementation

The method currently sends the same error message regardless of kick reason:

client.ws.send(
  JSON.stringify({
    type: "error",
    error: "Kicked from game (you may have been playing on another tab)",
  } satisfies ServerErrorMessage),
);

Proposed changes

  • Add optional reason parameter to kickClient() method
  • Send appropriate error message based on kick reason
  • Update all call sites to specify kick reason

Question: Should these new error messages be added to the translation system?

Metadata

Metadata

Assignees

Labels

Feature - FrontendAn entirely new feature, or changes to existing feature. User facing.good first issueGood for new contributors.

Type

Projects

Status

Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions