mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-02 11:26:53 +00:00
Add gRPC message retrieval
This commit is contained in:
1 parent
329d229ac7
commit
b6317a1b43
12 files changed
+1367
-44
No files matched your search
@@ -165,6 +165,7 @@ import org.whispersystems.textsecuregcm.grpc.GroupSendTokenUtil;
|
||||
import org.whispersystems.textsecuregcm.grpc.GrpcAllowListInterceptor;
|
||||
import org.whispersystems.textsecuregcm.grpc.KeysAnonymousGrpcService;
|
||||
import org.whispersystems.textsecuregcm.grpc.KeysGrpcService;
|
||||
import org.whispersystems.textsecuregcm.grpc.MessageDispatcher;
|
||||
import org.whispersystems.textsecuregcm.grpc.MessagesAnonymousGrpcService;
|
||||
import org.whispersystems.textsecuregcm.grpc.MessagesGrpcService;
|
||||
import org.whispersystems.textsecuregcm.grpc.MetricServerInterceptor;
|
||||
@@ -988,6 +989,10 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
|
||||
final RequireAuthenticationInterceptor requireAuthenticationInterceptor = new RequireAuthenticationInterceptor(accountAuthenticator);
|
||||
final ProhibitAuthenticationInterceptor prohibitAuthenticationInterceptor = new ProhibitAuthenticationInterceptor();
|
||||
final GroupSendTokenUtil groupSendTokenUtil = new GroupSendTokenUtil(zkSecretParams, Clock.systemUTC());
|
||||
final MessageMetrics messageMetrics = new MessageMetrics();
|
||||
final MessageDispatcher messageDispatcher = new MessageDispatcher(receiptSender, messagesManager, messageMetrics,
|
||||
pushNotificationManager, pushNotificationScheduler, messageDeliveryLoopMonitor, disconnectionRequestManager,
|
||||
clientReleaseManager);
|
||||
|
||||
final CertificateGenerator certificateGenerator =
|
||||
new CertificateGenerator(config.getDeliveryCertificate().certificate(),
|
||||
@@ -1001,7 +1006,7 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
|
||||
new CredentialsGrpcService(accountsManager, certificateGenerator, zkAuthOperations, callingGenericZkSecretParams, rateLimiters, Clock.systemUTC(), ExternalServiceDefinitions.createExternalServiceList(config, Clock.systemUTC())),
|
||||
new KeysGrpcService(accountsManager, keysManager, rateLimiters),
|
||||
new ProfileGrpcService(clock, accountsManager, profilesManager, dynamicConfigurationManager, config.getBadges(), profileCdnPolicyGenerator, profileCdnPolicySigner, profileBadgeConverter, rateLimiters),
|
||||
new MessagesGrpcService(accountsManager, rateLimiters, messageSender, messageByteLimitCardinalityEstimator, spamChecker, Clock.systemUTC()),
|
||||
new MessagesGrpcService(accountsManager, rateLimiters, messageSender, messageByteLimitCardinalityEstimator, spamChecker, messageDispatcher, Clock.systemUTC()),
|
||||
new BackupsGrpcService(accountsManager, backupAuthManager, backupMetrics),
|
||||
new DevicesGrpcService(accountsManager),
|
||||
new AttachmentsGrpcService(experimentEnrollmentManager, rateLimiters,
|
||||
@@ -1093,7 +1098,6 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
|
||||
final String provisioningWebsocketServletPath = "/v1/websocket/provisioning/";
|
||||
|
||||
MetricsHttpEventHandler.configure(environment, Metrics.globalRegistry, clientReleaseManager, Set.of(websocketServletPath, provisioningWebsocketServletPath, "/health-check"));
|
||||
final MessageMetrics messageMetrics = new MessageMetrics();
|
||||
|
||||
// BufferingInterceptor is needed on the base environment but not the WebSocketEnvironment,
|
||||
// because we handle serialization of http responses on the websocket on our own and can
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
/*
|
||||
* Copyright 2026 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
package org.whispersystems.textsecuregcm.grpc;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.protobuf.Empty;
|
||||
import io.micrometer.core.instrument.Metrics;
|
||||
import java.time.Duration;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
import org.signal.chat.messages.GetMessagesResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.whispersystems.textsecuregcm.auth.DisconnectionRequestListener;
|
||||
import org.whispersystems.textsecuregcm.auth.DisconnectionRequestManager;
|
||||
import org.whispersystems.textsecuregcm.entities.MessageProtos;
|
||||
import org.whispersystems.textsecuregcm.identity.IdentityType;
|
||||
import org.whispersystems.textsecuregcm.limits.MessageDeliveryLoopMonitor;
|
||||
import org.whispersystems.textsecuregcm.metrics.MessageMetrics;
|
||||
import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
|
||||
import org.whispersystems.textsecuregcm.push.PushNotificationManager;
|
||||
import org.whispersystems.textsecuregcm.push.PushNotificationScheduler;
|
||||
import org.whispersystems.textsecuregcm.push.ReceiptSender;
|
||||
import org.whispersystems.textsecuregcm.storage.Account;
|
||||
import org.whispersystems.textsecuregcm.storage.ClientReleaseManager;
|
||||
import org.whispersystems.textsecuregcm.storage.ConflictingMessageConsumerException;
|
||||
import org.whispersystems.textsecuregcm.storage.Device;
|
||||
import org.whispersystems.textsecuregcm.storage.MessageStream;
|
||||
import org.whispersystems.textsecuregcm.storage.MessageStreamEntry;
|
||||
import org.whispersystems.textsecuregcm.storage.MessagesManager;
|
||||
import org.whispersystems.textsecuregcm.util.UUIDUtil;
|
||||
import org.whispersystems.textsecuregcm.util.ua.UserAgent;
|
||||
import org.whispersystems.textsecuregcm.util.ua.UserAgentUtil;
|
||||
import reactor.adapter.JdkFlowAdapter;
|
||||
import reactor.core.observability.micrometer.Micrometer;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.core.publisher.Signal;
|
||||
import reactor.core.publisher.Sinks;
|
||||
|
||||
/// A MessageDispatcher is used to stream messages to an authenticated device and coordinates message acknowledgement,
|
||||
/// backpressure, disconnection signals, and receipts.
|
||||
public class MessageDispatcher {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MessageDispatcher.class);
|
||||
|
||||
@VisibleForTesting
|
||||
static final int MAX_UNACKED_MESSAGES = 256;
|
||||
@VisibleForTesting
|
||||
static final Duration CLOSE_WITH_PENDING_MESSAGES_NOTIFICATION_DELAY = Duration.ofMinutes(1);
|
||||
private static final int MESSAGE_PUBLISHER_LIMIT_RATE = 100;
|
||||
|
||||
public static final GetMessagesResponse QUEUE_EMPTY_RESPONSE =
|
||||
GetMessagesResponse.newBuilder().setQueueEmpty(Empty.getDefaultInstance()).build();
|
||||
private static final GetMessagesResponse CONFLICTING_STREAM_RESPONSE = GetMessagesResponse.newBuilder()
|
||||
.setTerminated(GetMessagesResponse.Terminated.newBuilder()
|
||||
.setConflictingStream(Empty.getDefaultInstance()))
|
||||
.build();
|
||||
private static final GetMessagesResponse REAUTHENTICATION_REQUIRED_RESPONSE = GetMessagesResponse.newBuilder()
|
||||
.setTerminated(GetMessagesResponse.Terminated.newBuilder()
|
||||
.setReauthenticationRequired(Empty.getDefaultInstance()))
|
||||
.build();
|
||||
|
||||
private static final String SEND_MESSAGES_FLUX_NAME = MetricsUtil.name(MessageDispatcher.class, "sendMessages");
|
||||
|
||||
private final ReceiptSender receiptSender;
|
||||
private final MessagesManager messagesManager;
|
||||
private final MessageMetrics messageMetrics;
|
||||
private final PushNotificationManager pushNotificationManager;
|
||||
private final PushNotificationScheduler pushNotificationScheduler;
|
||||
private final ClientReleaseManager clientReleaseManager;
|
||||
private final MessageDeliveryLoopMonitor messageDeliveryLoopMonitor;
|
||||
private final DisconnectionRequestManager disconnectionRequestManager;
|
||||
|
||||
public MessageDispatcher(final ReceiptSender receiptSender,
|
||||
final MessagesManager messagesManager,
|
||||
final MessageMetrics messageMetrics,
|
||||
final PushNotificationManager pushNotificationManager,
|
||||
final PushNotificationScheduler pushNotificationScheduler,
|
||||
final MessageDeliveryLoopMonitor messageDeliveryLoopMonitor,
|
||||
final DisconnectionRequestManager disconnectionRequestManager,
|
||||
final ClientReleaseManager clientReleaseManager) {
|
||||
this.receiptSender = receiptSender;
|
||||
this.messagesManager = messagesManager;
|
||||
this.messageMetrics = messageMetrics;
|
||||
this.pushNotificationManager = pushNotificationManager;
|
||||
this.pushNotificationScheduler = pushNotificationScheduler;
|
||||
this.messageDeliveryLoopMonitor = messageDeliveryLoopMonitor;
|
||||
this.disconnectionRequestManager = disconnectionRequestManager;
|
||||
this.clientReleaseManager = clientReleaseManager;
|
||||
}
|
||||
|
||||
/// Retrieve messages for the device.
|
||||
///
|
||||
/// ## Termination
|
||||
/// The returned message stream is potentially infinite. It will terminate if the device acknowledgement stream
|
||||
/// terminates for any reason. The error from the client will be propagated to the returned flux. The stream may also
|
||||
/// terminate with any other error encountered retrieving messages or processing acknowledgements.
|
||||
///
|
||||
/// The returned flux will emit a [GetMessagesResponse.Terminated] and then complete if
|
||||
/// - A disconnection request (typically indicating a change in authorization credentials) is received.
|
||||
/// - A client requests messages for the same account/device while this stream is still active
|
||||
///
|
||||
/// When the stream terminates for any reason and the client has messages remaining in their queue, a push
|
||||
/// notification is scheduled to encourage the client to wake up and try again after a delay.
|
||||
///
|
||||
/// ## Queue Empty
|
||||
/// The returned flux will emit a queue empty indicator when the device has successfully drained their waiting queue
|
||||
/// and acknowledged all of them. A queue empty response guarantees all messages that were waiting for the client when
|
||||
/// they first connected have been delivered and removed from storage, though it's possible the queue empty response
|
||||
/// also waits for messages that arrived in the intervening period.
|
||||
///
|
||||
/// ## Acknowledgement
|
||||
/// When the device acknowledges a message GUID it is removed from storage. If applicable, a delivery receipt is sent
|
||||
/// to the original sender of the message.
|
||||
///
|
||||
///
|
||||
/// @param shouldDropStories if true, stories will not be delivered in the response stream (and will be
|
||||
/// removed from persistent storage)
|
||||
/// @param userAgentString the userAgent of the requesting device
|
||||
/// @param account the account to retrieve messages for
|
||||
/// @param device the device to retrieve messages for
|
||||
/// @param acknowledgedMessageGuids A flux that should emit the server guid of messages when they have been
|
||||
/// acknowledged by the device
|
||||
/// @return The message stream
|
||||
public Flux<GetMessagesResponse> getMessages(
|
||||
final boolean shouldDropStories,
|
||||
@Nullable final String userAgentString,
|
||||
final Account account,
|
||||
final Device device,
|
||||
final Flux<UUID> acknowledgedMessageGuids) {
|
||||
|
||||
final MessageStream messageStream = messagesManager.getMessages(account.getIdentifier(IdentityType.ACI), device);
|
||||
@Nullable final UserAgent userAgent = UserAgentUtil.maybeParseUserAgentString(userAgentString);
|
||||
final PendingAcknowledgementTracker pendingAcknowledgementTracker = new PendingAcknowledgementTracker(messageMetrics, userAgent);
|
||||
|
||||
pushNotificationManager.handleMessagesRetrieved(account, device, userAgentString);
|
||||
|
||||
final Flux<GetMessagesResponse> messages = JdkFlowAdapter.flowPublisherToFlux(messageStream.getMessages())
|
||||
.name(SEND_MESSAGES_FLUX_NAME)
|
||||
.tap(Micrometer.metrics(Metrics.globalRegistry))
|
||||
.limitRate(MESSAGE_PUBLISHER_LIMIT_RATE)
|
||||
|
||||
// Check the first message we send for message-delivery loops
|
||||
.switchOnFirst((firstEntry, flux) -> {
|
||||
recordDeliveryAttempt(account, device, userAgentString, firstEntry);
|
||||
return flux;
|
||||
})
|
||||
.flatMapSequential(entry -> switch (entry) {
|
||||
case MessageStreamEntry.Envelope(final MessageProtos.Envelope envelope) -> {
|
||||
final UUID serverGuid = UUIDUtil.fromByteString(envelope.getServerGuid());
|
||||
if (envelope.getStory() && shouldDropStories) {
|
||||
// Just immediately delete stories if the device doesn't want them
|
||||
yield Mono.fromFuture(() -> messageStream.acknowledgeMessage(serverGuid, envelope.getServerTimestamp()))
|
||||
.then(Mono.empty());
|
||||
}
|
||||
|
||||
pendingAcknowledgementTracker.addUnacknowledgedEnvelope(envelope);
|
||||
final MessageProtos.Envelope stripped = envelope.toBuilder().clearEphemeral().build();
|
||||
messageMetrics.measureAccountEnvelopeUuidMismatches(account, envelope);
|
||||
messageMetrics.measureMessageSent(stripped.getSerializedSize());
|
||||
yield Mono.just(GetMessagesResponse.newBuilder().setEnvelope(stripped).build());
|
||||
}
|
||||
case MessageStreamEntry.QueueEmpty _ -> {
|
||||
pendingAcknowledgementTracker.markEndOfQueue();
|
||||
yield Mono.empty();
|
||||
}
|
||||
}, MAX_UNACKED_MESSAGES);
|
||||
|
||||
// Only emit envelopes when the permit flux emits a value. Initially it is seeded MAX_UNACKED_MESSAGES permits,
|
||||
// after that a permit is emitted every time we receive an ack.
|
||||
final Sinks.Many<Boolean> ackPermits = Sinks.many().unicast().onBackpressureBuffer();
|
||||
final Flux<Boolean> permits = Flux.range(0, MAX_UNACKED_MESSAGES)
|
||||
.map(_ -> true)
|
||||
.concatWith(ackPermits.asFlux());
|
||||
final Mono<GetMessagesResponse> ackCompletions = acknowledgedMessageGuids
|
||||
.flatMap(guid -> {
|
||||
final PendingAcknowledgementTracker.UnacknowledgedEnvelope unacked = pendingAcknowledgementTracker.takeUnacknowledgedEnvelope(guid);
|
||||
if (unacked == null) {
|
||||
// This is fine, the client may have sent a duplicate-ack
|
||||
return Mono.empty();
|
||||
}
|
||||
messageMetrics.measureOutgoingMessageLatency(
|
||||
unacked.getServerTimestamp(), MessageMetrics.GRPC_CHANNEL, device.isPrimary(),
|
||||
unacked.isUrgent(), unacked.isEphemeral(), userAgent, clientReleaseManager);
|
||||
|
||||
maybeSendDeliveryReceipt(device, unacked);
|
||||
|
||||
return Mono.fromFuture(() -> messageStream.acknowledgeMessage(unacked.getServerGuid(), unacked.getServerTimestamp()))
|
||||
.doOnSuccess(_ -> unacked.handleMessageAcknowledged())
|
||||
// Just have to emit some value that indicates we can release a permit
|
||||
.thenReturn(true);
|
||||
}, MAX_UNACKED_MESSAGES)
|
||||
.doOnNext(_ -> ackPermits.tryEmitNext(true))
|
||||
.ignoreElements()
|
||||
.cast(GetMessagesResponse.class);
|
||||
|
||||
return Flux.merge(
|
||||
// Emit messages, but only when a permit is available
|
||||
messages.zipWith(permits, (resp, _) -> resp),
|
||||
// Will only emit errors, but those should terminate the stream
|
||||
ackCompletions,
|
||||
// Emits a queue empty once all messages prior to the queueEmpty signal have been acked
|
||||
pendingAcknowledgementTracker.queueDrained(),
|
||||
// Emit a Terminated response if we receive a disconnection request
|
||||
disconnectionSignal(account, device))
|
||||
.onErrorResume(ConflictingMessageConsumerException.class, _ -> Mono.just(CONFLICTING_STREAM_RESPONSE))
|
||||
.takeUntil(response -> switch (response.getResponseCase()) {
|
||||
case ENVELOPE, QUEUE_EMPTY -> false;
|
||||
case TERMINATED -> {
|
||||
messageMetrics.measureMessageStreamDisplaced(MessageMetrics.GRPC_CHANNEL, userAgent,
|
||||
response.getTerminated().hasConflictingStream());
|
||||
yield true;
|
||||
}
|
||||
case RESPONSE_NOT_SET -> throw new IllegalStateException("tried to return an invalid GetMessagesResponse");
|
||||
})
|
||||
.doFinally(_ -> maybeSchedulePush(account, device));
|
||||
}
|
||||
|
||||
/// If the device potentially has more messages available, schedule a push notification.
|
||||
private void maybeSchedulePush(final Account account, final Device device) {
|
||||
messagesManager.mayHaveMessages(account.getIdentifier(IdentityType.ACI), device)
|
||||
.thenAccept(mayHaveMessages -> {
|
||||
if (mayHaveMessages) {
|
||||
pushNotificationScheduler.scheduleDelayedNotification(account, device,
|
||||
CLOSE_WITH_PENDING_MESSAGES_NOTIFICATION_DELAY);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Watch for a disconnection signal from the [DisconnectionRequestManager]
|
||||
///
|
||||
/// @return Mono that completes with a [org.signal.chat.messages.GetMessagesResponse.Terminated] response if the
|
||||
/// device receives a disconnection request
|
||||
private Mono<GetMessagesResponse> disconnectionSignal(final Account account, final Device device) {
|
||||
return Mono.create(sink -> {
|
||||
final DisconnectionRequestListener listener = () -> sink.success(REAUTHENTICATION_REQUIRED_RESPONSE);
|
||||
disconnectionRequestManager.addListener(account.getUuid(), device.getId(), listener);
|
||||
sink.onDispose(() -> disconnectionRequestManager.removeListener(account.getUuid(), device.getId(), listener));
|
||||
});
|
||||
}
|
||||
|
||||
private void recordDeliveryAttempt(final Account account, final Device device, final String userAgent,
|
||||
final Signal<? extends MessageStreamEntry> firstEntry) {
|
||||
if (firstEntry.get() instanceof MessageStreamEntry.Envelope(final MessageProtos.Envelope message)) {
|
||||
messageDeliveryLoopMonitor.recordDeliveryAttempt(account.getIdentifier(IdentityType.ACI),
|
||||
device.getId(),
|
||||
UUIDUtil.fromByteString(message.getServerGuid()),
|
||||
userAgent,
|
||||
MessageMetrics.GRPC_CHANNEL);
|
||||
}
|
||||
}
|
||||
|
||||
private void maybeSendDeliveryReceipt(
|
||||
final Device device,
|
||||
final PendingAcknowledgementTracker.UnacknowledgedEnvelope unacknowledgedEnvelope) {
|
||||
if (unacknowledgedEnvelope.getSourceServiceId() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
receiptSender.sendReceipt(
|
||||
unacknowledgedEnvelope.getDestinationServiceId(),
|
||||
device.getId(),
|
||||
unacknowledgedEnvelope.getSourceServiceId(),
|
||||
unacknowledgedEnvelope.getClientTimestamp());
|
||||
} catch (final Exception e) {
|
||||
log.warn("Failed to send receipt", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,13 @@ import com.google.protobuf.Empty;
|
||||
import java.time.Clock;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Flow;
|
||||
import java.util.stream.Collectors;
|
||||
import io.grpc.StatusRuntimeException;
|
||||
import org.signal.chat.errors.NotFound;
|
||||
import org.signal.chat.messages.GetMessagesRequest;
|
||||
import org.signal.chat.messages.GetMessagesResponse;
|
||||
import org.signal.chat.messages.IndividualRecipientMessageBundle;
|
||||
import org.signal.chat.messages.SendAuthenticatedSenderMessageRequest;
|
||||
import org.signal.chat.messages.SendMessageAuthenticatedSenderResponse;
|
||||
@@ -38,6 +43,11 @@ import org.whispersystems.textsecuregcm.spam.SpamCheckResult;
|
||||
import org.whispersystems.textsecuregcm.spam.SpamChecker;
|
||||
import org.whispersystems.textsecuregcm.storage.Account;
|
||||
import org.whispersystems.textsecuregcm.storage.AccountsManager;
|
||||
import org.whispersystems.textsecuregcm.storage.Device;
|
||||
import org.whispersystems.textsecuregcm.util.UUIDUtil;
|
||||
import reactor.adapter.JdkFlowAdapter;
|
||||
import reactor.core.publisher.Flux;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class MessagesGrpcService extends SimpleMessagesGrpc.MessagesImplBase {
|
||||
|
||||
@@ -46,6 +56,7 @@ public class MessagesGrpcService extends SimpleMessagesGrpc.MessagesImplBase {
|
||||
private final MessageSender messageSender;
|
||||
private final CardinalityEstimator messageByteLimitEstimator;
|
||||
private final SpamChecker spamChecker;
|
||||
private final MessageDispatcher messageDispatcher;
|
||||
private final Clock clock;
|
||||
|
||||
private static final SendMessageAuthenticatedSenderResponse SEND_MESSAGE_SUCCESS_RESPONSE =
|
||||
@@ -56,6 +67,7 @@ public class MessagesGrpcService extends SimpleMessagesGrpc.MessagesImplBase {
|
||||
final MessageSender messageSender,
|
||||
final CardinalityEstimator messageByteLimitEstimator,
|
||||
final SpamChecker spamChecker,
|
||||
final MessageDispatcher messageDispatcher,
|
||||
final Clock clock) {
|
||||
|
||||
this.accountsManager = accountsManager;
|
||||
@@ -63,9 +75,49 @@ public class MessagesGrpcService extends SimpleMessagesGrpc.MessagesImplBase {
|
||||
this.messageSender = messageSender;
|
||||
this.messageByteLimitEstimator = messageByteLimitEstimator;
|
||||
this.spamChecker = spamChecker;
|
||||
this.messageDispatcher = messageDispatcher;
|
||||
this.clock = clock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flow.Publisher<GetMessagesResponse> getMessages(final Flow.Publisher<GetMessagesRequest> request) throws Exception {
|
||||
final AuthenticatedDevice authenticatedDevice = AuthenticationUtil.requireAuthenticatedDevice();
|
||||
final Account account = accountsManager
|
||||
.getByAccountIdentifier(authenticatedDevice.accountIdentifier())
|
||||
.orElseThrow(() -> GrpcExceptions.invalidCredentials("invalid credentials"));
|
||||
final Device device = account.getDevice(authenticatedDevice.deviceId())
|
||||
.orElseThrow(() -> GrpcExceptions.invalidCredentials("invalid credentials"));
|
||||
final String userAgent = RequestAttributesUtil.getUserAgent().orElse(null);
|
||||
|
||||
final Flux<GetMessagesRequest> requestFlux = JdkFlowAdapter.flowPublisherToFlux(request);
|
||||
|
||||
return JdkFlowAdapter.publisherToFlowPublisher(requestFlux.switchOnFirst((firstSignal, flux) -> {
|
||||
@Nullable final GetMessagesRequest streamRequest = firstSignal.get();
|
||||
if (streamRequest == null) {
|
||||
// Just forward the error or completion signal
|
||||
return flux.then().cast(GetMessagesResponse.class);
|
||||
}
|
||||
if (!streamRequest.hasOptions()) {
|
||||
throw GrpcExceptions.fieldViolation("request", "the first request must be GetMessageOptions");
|
||||
}
|
||||
final boolean dropStories = streamRequest.getOptions().getDropStories();
|
||||
return messageDispatcher.getMessages(dropStories, userAgent, account, device,
|
||||
flux.skip(1).map(MessagesGrpcService::extractAckGuid));
|
||||
}));
|
||||
}
|
||||
|
||||
private static UUID extractAckGuid(final GetMessagesRequest ack) throws StatusRuntimeException {
|
||||
if (!ack.hasServerGuidAck()) {
|
||||
throw GrpcExceptions.fieldViolation("request", "All non-initial GetMessageRequests must contain a server_guid_ack");
|
||||
}
|
||||
try {
|
||||
return UUIDUtil.fromByteString(ack.getServerGuidAck());
|
||||
} catch (final IllegalArgumentException e) {
|
||||
throw GrpcExceptions.fieldViolation("server_guid_ack", "invalid server_guid_ack");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SendMessageAuthenticatedSenderResponse sendMessage(final SendAuthenticatedSenderMessageRequest request)
|
||||
throws RateLimitExceededException {
|
||||
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* Copyright 2026 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
package org.whispersystems.textsecuregcm.grpc;
|
||||
|
||||
import io.micrometer.core.instrument.Timer;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import javax.annotation.Nullable;
|
||||
import org.signal.chat.messages.GetMessagesResponse;
|
||||
import org.whispersystems.textsecuregcm.entities.MessageProtos;
|
||||
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
|
||||
import org.whispersystems.textsecuregcm.identity.ServiceIdentifier;
|
||||
import org.whispersystems.textsecuregcm.metrics.MessageMetrics;
|
||||
import org.whispersystems.textsecuregcm.util.ClosableEpoch;
|
||||
import org.whispersystems.textsecuregcm.util.UUIDUtil;
|
||||
import org.whispersystems.textsecuregcm.util.ua.UserAgent;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.core.publisher.Sinks;
|
||||
|
||||
/// Track messages while they are in-flight so they can later be retrieved for acknowledgement, as well as when
|
||||
/// acknowledgement completes.
|
||||
///
|
||||
/// # Example Usage
|
||||
/// ```java
|
||||
/// PendingAcknowledgement tracker = new PendingAcknowledgementTracker(...);
|
||||
/// tracker.addUnacknowledgedEnvelope(envelope);
|
||||
/// sendEnvelopeToDevice(envelope);
|
||||
///
|
||||
/// // Later, when the device acklowedges the envelope
|
||||
/// UnacknowledgedEnvelope envelope = takeUnacknowledgedEnvelope(uuid);
|
||||
/// removeFromStorage(envelope);
|
||||
/// envelope.handleMessageAcknowledged();
|
||||
/// ```
|
||||
class PendingAcknowledgementTracker {
|
||||
|
||||
private final ConcurrentHashMap<UUID, UnacknowledgedEnvelope> unacknowledgedEnvelopes = new ConcurrentHashMap<>();
|
||||
private final AtomicLong sentMessageCounter = new AtomicLong();
|
||||
|
||||
private final Sinks.One<GetMessagesResponse> queueDrained = Sinks.one();
|
||||
private final ClosableEpoch queueDrainEpoch = new ClosableEpoch(() ->
|
||||
queueDrained.tryEmitValue(MessageDispatcher.QUEUE_EMPTY_RESPONSE));
|
||||
private final Timer.Sample queueDrainStart = Timer.start();
|
||||
|
||||
private final MessageMetrics messageMetrics;
|
||||
@Nullable private final UserAgent userAgent;
|
||||
|
||||
PendingAcknowledgementTracker(final MessageMetrics messageMetrics, @Nullable final UserAgent userAgent) {
|
||||
this.messageMetrics = messageMetrics;
|
||||
this.userAgent = userAgent;
|
||||
}
|
||||
|
||||
/// Store an envelope so it can be retrieved later via [#takeUnacknowledgedEnvelope].
|
||||
///
|
||||
/// @param envelope An envelope that has been sent to a device and is waiting to be acknowledged
|
||||
void addUnacknowledgedEnvelope(final MessageProtos.Envelope envelope) {
|
||||
sentMessageCounter.incrementAndGet();
|
||||
final UUID messageGuid = UUIDUtil.fromByteString(envelope.getServerGuid());
|
||||
final AciServiceIdentifier sourceId = envelope.hasSourceServiceId() && envelope.getType() != MessageProtos.Envelope.Type.SERVER_DELIVERY_RECEIPT
|
||||
? AciServiceIdentifier.fromByteString(envelope.getSourceServiceId())
|
||||
: null;
|
||||
final ServiceIdentifier destinationId = ServiceIdentifier.fromByteString(envelope.getDestinationServiceId());
|
||||
final UnacknowledgedEnvelope unacknowledgedEnvelope = new UnacknowledgedEnvelope(messageGuid,
|
||||
envelope.getServerTimestamp(), envelope.getClientTimestamp(),
|
||||
envelope.getUrgent(), envelope.getEphemeral(),
|
||||
destinationId, sourceId);
|
||||
unacknowledgedEnvelopes.put(messageGuid, unacknowledgedEnvelope);
|
||||
}
|
||||
|
||||
/// Take a previously stored envelope so it can be acknowledged. When the message is successfully removed from
|
||||
/// storage, call [UnacknowledgedEnvelope#handleMessageAcknowledged()].
|
||||
///
|
||||
/// @param guid The server GUID of the envelope previously stored with [#addUnacknowledgedEnvelope(MessageProtos.Envelope)].
|
||||
/// @return The previously stored envelope, or null if no envelope with the provided guid was stored
|
||||
@Nullable
|
||||
UnacknowledgedEnvelope takeUnacknowledgedEnvelope(final UUID guid) {
|
||||
return unacknowledgedEnvelopes.remove(guid);
|
||||
}
|
||||
|
||||
/// Signal that we've observed the end of the initial message queue. The Mono returned by [#queueDrained] will emit a
|
||||
/// value when all current envelopes tracked with [#addUnacknowledgedEnvelope] have been marked [UnacknowledgedEnvelope#handleMessageAcknowledged()]
|
||||
void markEndOfQueue() {
|
||||
messageMetrics
|
||||
.measureQueueDrain(MessageMetrics.GRPC_CHANNEL, userAgent, sentMessageCounter.get(), queueDrainStart);
|
||||
queueDrainEpoch.close();
|
||||
}
|
||||
|
||||
/// Determine when a queue has been drained.
|
||||
///
|
||||
/// @return A mono that completes with a QueueEmpty response when all messages tracked before [#markEndOfQueue] have
|
||||
/// been acknowledged.
|
||||
Mono<GetMessagesResponse> queueDrained() {
|
||||
return queueDrained.asMono();
|
||||
}
|
||||
|
||||
|
||||
class UnacknowledgedEnvelope {
|
||||
|
||||
private final UUID serverGuid;
|
||||
private final long serverTimestamp;
|
||||
private final Timer.Sample sample;
|
||||
private final boolean inDrainEpoch;
|
||||
private final long clientTimestamp;
|
||||
private final boolean urgent;
|
||||
private final boolean ephemeral;
|
||||
private final ServiceIdentifier destinationServiceId;
|
||||
@Nullable private final AciServiceIdentifier sourceServiceId;
|
||||
|
||||
private UnacknowledgedEnvelope(
|
||||
final UUID serverGuid,
|
||||
final long serverTimestamp,
|
||||
final long clientTimestamp,
|
||||
final boolean urgent,
|
||||
final boolean ephemeral,
|
||||
final ServiceIdentifier destinationServiceId,
|
||||
@Nullable final AciServiceIdentifier sourceServiceId) {
|
||||
this.serverGuid = serverGuid;
|
||||
this.serverTimestamp = serverTimestamp;
|
||||
this.clientTimestamp = clientTimestamp;
|
||||
this.urgent = urgent;
|
||||
this.ephemeral = ephemeral;
|
||||
this.destinationServiceId = destinationServiceId;
|
||||
this.sample = Timer.start();
|
||||
this.inDrainEpoch = queueDrainEpoch.tryArrive();
|
||||
this.sourceServiceId = sourceServiceId;
|
||||
}
|
||||
|
||||
void handleMessageAcknowledged() {
|
||||
messageMetrics.measureSendMessageDuration(MessageMetrics.GRPC_CHANNEL, userAgent, sample);
|
||||
if (inDrainEpoch) {
|
||||
queueDrainEpoch.depart();
|
||||
}
|
||||
}
|
||||
|
||||
public UUID getServerGuid() {
|
||||
return serverGuid;
|
||||
}
|
||||
|
||||
public long getServerTimestamp() {
|
||||
return serverTimestamp;
|
||||
}
|
||||
|
||||
public long getClientTimestamp() {
|
||||
return clientTimestamp;
|
||||
}
|
||||
|
||||
public boolean isUrgent() {
|
||||
return urgent;
|
||||
}
|
||||
|
||||
public boolean isEphemeral() {
|
||||
return ephemeral;
|
||||
}
|
||||
|
||||
public ServiceIdentifier getDestinationServiceId() {
|
||||
return destinationServiceId;
|
||||
}
|
||||
|
||||
/// Get the sender of this message
|
||||
///
|
||||
/// @return the ServiceIdentifier of the source of this message. `null` if the message sender was not identified or
|
||||
/// if the envelope was for a server delivery receipt
|
||||
@Nullable
|
||||
public AciServiceIdentifier getSourceServiceId() {
|
||||
return sourceServiceId;
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
-12
@@ -19,24 +19,31 @@ import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HexFormat;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.whispersystems.textsecuregcm.entities.MessageProtos;
|
||||
import org.whispersystems.textsecuregcm.identity.ServiceIdentifier;
|
||||
import org.whispersystems.textsecuregcm.storage.Account;
|
||||
import org.whispersystems.textsecuregcm.storage.ClientReleaseManager;
|
||||
import org.whispersystems.textsecuregcm.util.ua.UserAgent;
|
||||
import org.whispersystems.textsecuregcm.websocket.WebSocketConnection;
|
||||
|
||||
public final class MessageMetrics {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(MessageMetrics.class);
|
||||
|
||||
public static String GRPC_CHANNEL = "grpc";
|
||||
public static String WEBSOCKET_CHANNEL = "websocket";
|
||||
|
||||
@VisibleForTesting
|
||||
static final String MISMATCHED_ACCOUNT_ENVELOPE_UUID_COUNTER_NAME = name(MessageMetrics.class,
|
||||
"mismatchedAccountEnvelopeUuid");
|
||||
|
||||
public static final String DELIVERY_LATENCY_TIMER_NAME = name(MessageMetrics.class, "deliveryLatency");
|
||||
private static final String SEND_MESSAGE_DURATION_TIMER_NAME = name(WebSocketConnection.class, "sendMessageDuration");
|
||||
|
||||
// Uses [WebSocketConnection] for backwards compatibility
|
||||
private static final String SEND_MESSAGE_DURATION_TIMER_NAME = name(WebSocketConnection.class, "sendMessageDuration");
|
||||
private static final String INITIAL_QUEUE_LENGTH_DISTRIBUTION_NAME = name(WebSocketConnection.class, "initialQueueLength");
|
||||
private static final String INITIAL_QUEUE_DRAIN_TIMER_NAME = name(WebSocketConnection.class, "drainInitialQueue");
|
||||
private static final String SLOW_QUEUE_DRAIN_COUNTER_NAME = name(WebSocketConnection.class, "slowQueueDrain");
|
||||
@@ -84,7 +91,7 @@ public final class MessageMetrics {
|
||||
final boolean isPrimaryDevice,
|
||||
final boolean isUrgent,
|
||||
final boolean isEphemeral,
|
||||
final String userAgent,
|
||||
@Nullable final UserAgent userAgent,
|
||||
final ClientReleaseManager clientReleaseManager) {
|
||||
|
||||
final List<Tag> tags = new ArrayList<>();
|
||||
@@ -104,25 +111,26 @@ public final class MessageMetrics {
|
||||
|
||||
public void measureMessageStreamDisplaced(
|
||||
final String channel,
|
||||
final Tags platformTag,
|
||||
@Nullable final UserAgent userAgent,
|
||||
final boolean connectedElsewhere) {
|
||||
metricRegistry.counter(
|
||||
DISPLACEMENT_COUNTER_NAME,
|
||||
platformTag
|
||||
.and("connectedElsewhere", Boolean.toString(connectedElsewhere))
|
||||
.and("channel", channel))
|
||||
Tags.of(UserAgentTagUtil.getPlatformTag(userAgent),
|
||||
Tag.of("connectedElsewhere", Boolean.toString(connectedElsewhere)),
|
||||
Tag.of("channel", channel)))
|
||||
.increment();
|
||||
}
|
||||
|
||||
public void measureQueueDrain(
|
||||
final String channel,
|
||||
final Tags platformTag,
|
||||
@Nullable final UserAgent userAgent,
|
||||
final long messagesDrained,
|
||||
final Timer.Sample drainStart) {
|
||||
metricRegistry.summary(INITIAL_QUEUE_LENGTH_DISTRIBUTION_NAME, platformTag.and("channel", channel)).record(messagesDrained);
|
||||
final long drainDurationNanos = drainStart.stop(metricRegistry.timer(INITIAL_QUEUE_DRAIN_TIMER_NAME, platformTag));
|
||||
final Tags tags = Tags.of(UserAgentTagUtil.getPlatformTag(userAgent), Tag.of("channel", channel));
|
||||
metricRegistry.summary(INITIAL_QUEUE_LENGTH_DISTRIBUTION_NAME, tags).record(messagesDrained);
|
||||
final long drainDurationNanos = drainStart.stop(metricRegistry.timer(INITIAL_QUEUE_DRAIN_TIMER_NAME, tags));
|
||||
if (Duration.ofNanos(drainDurationNanos).compareTo(SLOW_DRAIN_THRESHOLD) > 0) {
|
||||
metricRegistry.counter(SLOW_QUEUE_DRAIN_COUNTER_NAME, platformTag.and("channel", channel)).increment();
|
||||
metricRegistry.counter(SLOW_QUEUE_DRAIN_COUNTER_NAME, tags).increment();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,9 +139,9 @@ public final class MessageMetrics {
|
||||
bytesSentCounter.increment(messageByteLength);
|
||||
}
|
||||
|
||||
public void measureSendMessageDuration(final String channel, final Tags platformTag, final Timer.Sample sample) {
|
||||
public void measureSendMessageDuration(final String channel, @Nullable final UserAgent userAgent, final Timer.Sample sample) {
|
||||
sample.stop(Timer.builder(SEND_MESSAGE_DURATION_TIMER_NAME)
|
||||
.tags(platformTag.and("channel", channel))
|
||||
.tags(Tags.of(UserAgentTagUtil.getPlatformTag(userAgent), Tag.of("channel", channel)))
|
||||
.register(metricRegistry));
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,11 @@
|
||||
package org.whispersystems.textsecuregcm.util.ua;
|
||||
|
||||
import com.vdurmont.semver4j.Semver;
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class UserAgentUtil {
|
||||
|
||||
@@ -31,4 +33,12 @@ public class UserAgentUtil {
|
||||
|
||||
throw new UnrecognizedUserAgentException();
|
||||
}
|
||||
|
||||
public static @Nullable UserAgent maybeParseUserAgentString(final String userAgentString) {
|
||||
try {
|
||||
return parseUserAgentString(userAgentString);
|
||||
} catch (UnrecognizedUserAgentException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
-13
@@ -24,6 +24,7 @@ import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.concurrent.atomic.LongAdder;
|
||||
import javax.annotation.Nullable;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.jetty.util.StaticException;
|
||||
import org.slf4j.Logger;
|
||||
@@ -50,6 +51,8 @@ import org.whispersystems.textsecuregcm.storage.MessageStreamEntry;
|
||||
import org.whispersystems.textsecuregcm.storage.MessagesManager;
|
||||
import org.whispersystems.textsecuregcm.util.HeaderUtils;
|
||||
import org.whispersystems.textsecuregcm.util.UUIDUtil;
|
||||
import org.whispersystems.textsecuregcm.util.ua.UserAgent;
|
||||
import org.whispersystems.textsecuregcm.util.ua.UserAgentUtil;
|
||||
import org.whispersystems.websocket.WebSocketClient;
|
||||
import org.whispersystems.websocket.WebSocketResourceProvider;
|
||||
import org.whispersystems.websocket.messages.WebSocketResponseMessage;
|
||||
@@ -58,7 +61,6 @@ import reactor.core.Disposable;
|
||||
import reactor.core.observability.micrometer.Micrometer;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.core.scheduler.Scheduler;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class WebSocketConnection implements DisconnectionRequestListener {
|
||||
|
||||
@@ -98,7 +100,7 @@ public class WebSocketConnection implements DisconnectionRequestListener {
|
||||
private final Device authenticatedDevice;
|
||||
private final MessageStream messageStream;
|
||||
private final WebSocketClient client;
|
||||
private final Tags platformTag;
|
||||
private final @Nullable UserAgent userAgent;
|
||||
|
||||
private final LongAdder sentMessageCounter = new LongAdder();
|
||||
private final AtomicReference<Disposable> messageSubscription = new AtomicReference<>();
|
||||
@@ -137,7 +139,7 @@ public class WebSocketConnection implements DisconnectionRequestListener {
|
||||
this.messageStream =
|
||||
messagesManager.getMessages(authenticatedAccount.getIdentifier(IdentityType.ACI), authenticatedDevice);
|
||||
|
||||
this.platformTag = Tags.of(UserAgentTagUtil.getPlatformTag(client.getUserAgent()));
|
||||
this.userAgent = UserAgentUtil.maybeParseUserAgentString(client.getUserAgent());
|
||||
}
|
||||
|
||||
public void start() {
|
||||
@@ -155,7 +157,7 @@ public class WebSocketConnection implements DisconnectionRequestListener {
|
||||
// process messages before sending the "connected elsewhere" signal, and while that's ultimately not harmful,
|
||||
// it's also not ideal.
|
||||
.doOnError(ConflictingMessageConsumerException.class, _ -> {
|
||||
messageMetrics.measureMessageStreamDisplaced("websocket", platformTag, true);
|
||||
messageMetrics.measureMessageStreamDisplaced(MessageMetrics.WEBSOCKET_CHANNEL, userAgent, true);
|
||||
client.close(4409, "Connected elsewhere");
|
||||
})
|
||||
.doOnNext(entry -> {
|
||||
@@ -165,7 +167,7 @@ public class WebSocketConnection implements DisconnectionRequestListener {
|
||||
authenticatedDevice.getId(),
|
||||
UUIDUtil.fromByteString(message.getServerGuid()),
|
||||
client.getUserAgent(),
|
||||
"websocket");
|
||||
MessageMetrics.WEBSOCKET_CHANNEL);
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -177,7 +179,7 @@ public class WebSocketConnection implements DisconnectionRequestListener {
|
||||
.subscribe(
|
||||
entry -> {
|
||||
if (entry instanceof MessageStreamEntry.QueueEmpty) {
|
||||
messageMetrics.measureQueueDrain("websocket", platformTag, sentMessageCounter.sum(), queueDrainStart);
|
||||
messageMetrics.measureQueueDrain(MessageMetrics.WEBSOCKET_CHANNEL, userAgent, sentMessageCounter.sum(), queueDrainStart);
|
||||
client.sendRequest("PUT", "/api/v1/queue/empty",
|
||||
Collections.singletonList(HeaderUtils.getTimestampHeader()), Optional.empty());
|
||||
}
|
||||
@@ -259,11 +261,11 @@ public class WebSocketConnection implements DisconnectionRequestListener {
|
||||
sendFailuresCounter.increment();
|
||||
} else {
|
||||
messageMetrics.measureOutgoingMessageLatency(serverTimestamp,
|
||||
"websocket",
|
||||
MessageMetrics.WEBSOCKET_CHANNEL,
|
||||
authenticatedDevice.isPrimary(),
|
||||
isUrgent,
|
||||
isEphemeral,
|
||||
client.getUserAgent(),
|
||||
userAgent,
|
||||
clientReleaseManager);
|
||||
}
|
||||
}).thenCompose(response -> {
|
||||
@@ -283,7 +285,7 @@ public class WebSocketConnection implements DisconnectionRequestListener {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Tags tags = platformTag.and(STATUS_CODE_TAG, String.valueOf(response.getStatus()));
|
||||
Tags tags = Tags.of(UserAgentTagUtil.getPlatformTag(userAgent), Tag.of(STATUS_CODE_TAG, String.valueOf(response.getStatus())));
|
||||
|
||||
// TODO Remove this once we've identified the cause of message rejections from desktop clients
|
||||
if (StringUtils.isNotBlank(response.getMessage())) {
|
||||
@@ -297,7 +299,7 @@ public class WebSocketConnection implements DisconnectionRequestListener {
|
||||
|
||||
return result;
|
||||
})
|
||||
.thenRun(() -> messageMetrics.measureSendMessageDuration("websocket", platformTag, sample));
|
||||
.thenRun(() -> messageMetrics.measureSendMessageDuration(MessageMetrics.WEBSOCKET_CHANNEL, userAgent, sample));
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -321,8 +323,10 @@ public class WebSocketConnection implements DisconnectionRequestListener {
|
||||
errorType = "other";
|
||||
}
|
||||
|
||||
Metrics.counter(SEND_MESSAGE_ERROR_COUNTER,
|
||||
platformTag.and(ERROR_TYPE_TAG, errorType, EXCEPTION_TYPE_TAG, e.getClass().getSimpleName()))
|
||||
Metrics.counter(SEND_MESSAGE_ERROR_COUNTER, Tags.of(
|
||||
UserAgentTagUtil.getPlatformTag(userAgent),
|
||||
Tag.of(ERROR_TYPE_TAG, errorType),
|
||||
Tag.of(EXCEPTION_TYPE_TAG, e.getClass().getSimpleName())))
|
||||
.increment();
|
||||
}
|
||||
|
||||
@@ -336,7 +340,7 @@ public class WebSocketConnection implements DisconnectionRequestListener {
|
||||
|
||||
@Override
|
||||
public void handleDisconnectionRequest() {
|
||||
messageMetrics.measureMessageStreamDisplaced("websocket", platformTag, false);
|
||||
messageMetrics.measureMessageStreamDisplaced(MessageMetrics.WEBSOCKET_CHANNEL, userAgent, false);
|
||||
client.close(4401, "Reauthentication required");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user