PLEXICHATNarrative Docs

Close-Codes

Guides, route-group overviews, and live schema entry points for the Plexichat backend.

REST http://api.plexichat.com/api/v1Gateway ws://api.plexichat.com/gatewayVersion a.1.0-49

Gateway Close Codes

The backend defines these application close codes in src/api/websocket/opcodes.py.

Defined Close Codes

CodeNameMeaning
4000UNKNOWN_ERRORgeneric internal error
4001UNKNOWN_OPCODEunrecognized opcode received
4002DECODE_ERRORinvalid payload encoding or shape
4003NOT_AUTHENTICATEDclient tried to act before identifying
4004AUTHENTICATION_FAILEDtoken invalid or rejected
4005ALREADY_AUTHENTICATEDduplicate identify on an active session
4007INVALID_SEQresume sequence invalid
4008RATE_LIMITEDgateway-level rate limit exceeded
4009SESSION_TIMED_OUTsession expired while disconnected
4010INVALID_SHARDinvalid shard requested
4011SHARDING_REQUIREDsharding required for this workload
4012INVALID_API_VERSIONunsupported API or gateway version
4013INVALID_INTENTSmalformed or unsupported intents
4014DISALLOWED_INTENTSrequested intents are not permitted
4015VERSION_OUTDATEDclient must update before reconnecting
4016SERVER_MAINTENANCEserver is entering or in maintenance mode
4017SERVER_SHUTDOWNserver is shutting down intentionally

Client Guidance

  • treat 4004, 4007, and 4009 as signals to stop trying to resume blindly
  • re-identify only when the close reason indicates that a fresh session is appropriate
  • back off when rate-limited instead of reconnecting in a tight loop
  • log both the close code and the most recent opcode/event context for debugging