validateSessionId static method

CometChatCallsException? validateSessionId(
  1. String? sessionId
)

Validates sessionId for token generation and session joining. Returns null if valid, CometChatCallsException if invalid.

Implementation

static CometChatCallsException? validateSessionId(String? sessionId) {
  if (sessionId == null) {
    return CometChatCallsException(
      ErrorCodeConstants.codeSessionIdNull,
      ErrorMessageConstants.messageSessionIdEmptyError,
      ErrorDetailConstants.detailSessionIdEmptyError,
    );
  }
  if (sessionId.trim().isEmpty) {
    return CometChatCallsException(
      ErrorCodeConstants.codeSessionIdEmpty,
      ErrorMessageConstants.messageSessionIdEmptyError,
      ErrorDetailConstants.detailSessionIdEmptyError,
    );
  }
  return null;
}