Comment / document possible error responses.

This commit is contained in:
Joachim Bauch 2025-06-12 08:46:48 +02:00
commit 6b04363faf
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02
2 changed files with 37 additions and 15 deletions

View file

@ -285,13 +285,18 @@ authorized, the backend returns an error and the hello request will be rejected.
### Error codes
- `unsupported-version`: The requested version is not supported.
- `auth-failed`: The session could not be authenticated.
- `too-many-sessions`: Too many sessions exist for this user id.
- `invalid_request`: The backend request for the v1 hello could not be authenticated. Check your shared secret.
- `invalid_hello_version`: The requested `hello` version is not supported.
- `auth_failed`: The session could not be authenticated.
- `invalid_backend`: The requested backend URL is not supported.
- `invalid_client_type`: The [client type](#client-types) is not supported.
- `invalid_ticket`: The passed ticket in the v1 hello is invalid.
- `no_such_user`: The user id in the v1 hello does not exists.
- `invalid_token`: The passed token is invalid (can happen for
[client type `internal`](#client-type-internal)).
[client type `internal`](#client-type-internal) or v2 requests).
- `token_not_valid_yet`: The token could be authenticated but is not valid yet.
- `token_expired`: The token could be authenticated but is expired.
- `too_many_requests`: Too many failed requests from this client.
### Client types
@ -389,6 +394,7 @@ server will return an error and a normal `hello` handshake has to be performed.
### Error codes
- `no_such_session`: The session id is no longer valid.
- `too_many_requests`: Too many failed requests from this client.
## Releasing sessions
@ -521,8 +527,11 @@ user, the backend returns an error and the room request will be rejected.
### Error codes
- `invalid_request`: The backend request could not be authenticated. Check your shared secret.
- `no_such_room`: The requested room does not exist or the user is not invited
to the room.
- `duplicate_session`: The given session already joined the room.
- `room_join_failed`: The Talk backend returned an unexpected response while joining the room.
## Join federated room

35
hub.go
View file

@ -54,18 +54,31 @@ import (
)
var (
DuplicateClient = NewError("duplicate_client", "Client already registered.")
HelloExpected = NewError("hello_expected", "Expected Hello request.")
// HelloExpected is returned if a client sends a message before the "hello" request.
HelloExpected = NewError("hello_expected", "Expected Hello request.")
// InvalidHelloVersion is returned if the version in the "hello" message is not supported.
InvalidHelloVersion = NewError("invalid_hello_version", "The hello version is not supported.")
UserAuthFailed = NewError("auth_failed", "The user could not be authenticated.")
RoomJoinFailed = NewError("room_join_failed", "Could not join the room.")
InvalidClientType = NewError("invalid_client_type", "The client type is not supported.")
InvalidBackendUrl = NewError("invalid_backend", "The backend URL is not supported.")
InvalidToken = NewError("invalid_token", "The passed token is invalid.")
NoSuchSession = NewError("no_such_session", "The session to resume does not exist.")
TokenNotValidYet = NewError("token_not_valid_yet", "The token is not valid yet.")
TokenExpired = NewError("token_expired", "The token is expired.")
TooManyRequests = NewError("too_many_requests", "Too many requests.")
// UserAuthFailed is returned if the Talk response to a v1 hello is not an error but also not a valid auth response.
UserAuthFailed = NewError("auth_failed", "The user could not be authenticated.")
// RoomJoinFailed is returned if the Talk response to a room join request is not an error and not a valid join response.
RoomJoinFailed = NewError("room_join_failed", "Could not join the room.")
// InvalidClientType is returned if the client type in the "hello" request is not supported.
InvalidClientType = NewError("invalid_client_type", "The client type is not supported.")
// InvalidBackendUrl is returned if no backend is configured for URL in the "hello" request.
InvalidBackendUrl = NewError("invalid_backend", "The backend URL is not supported.")
// InvalidToken is returned if the token in a "hello" request could not be validated.
InvalidToken = NewError("invalid_token", "The passed token is invalid.")
// NoSuchSession is returned if the session to be resumed is unknown or expired.
NoSuchSession = NewError("no_such_session", "The session to resume does not exist.")
// TokenNotValidYet is returned if the token in a "hello" request could be authenticated but is not valid yet.
// This hints to a mismatch in the time between the server running Talk and the server running the signaling server.
TokenNotValidYet = NewError("token_not_valid_yet", "The token is not valid yet.")
// TokenExpired is returned if the token in a "hello" request could be authenticated but is expired.
// This hints to a mismatch in the time between the server running Talk and the server running the signaling server,
// but could also be a client trying to connect with an old token.
TokenExpired = NewError("token_expired", "The token is expired.")
// TooManyRequests is returned if brute force detection reports too many failed "hello" requests.
TooManyRequests = NewError("too_many_requests", "Too many requests.")
// Maximum number of concurrent requests to a backend.
defaultMaxConcurrentRequestsPerHost = 8