// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections;
using System.Threading;
namespace MQTTnet.Server
{
public sealed class InterceptingPublishEventArgs : EventArgs
{
public InterceptingPublishEventArgs(MqttApplicationMessage applicationMessage, CancellationToken cancellationToken, string clientId, IDictionary sessionItems)
{
ApplicationMessage = applicationMessage ?? throw new ArgumentNullException(nameof(applicationMessage));
CancellationToken = cancellationToken;
ClientId = clientId ?? throw new ArgumentNullException(nameof(clientId));
SessionItems = sessionItems ?? throw new ArgumentNullException(nameof(sessionItems));
}
public MqttApplicationMessage ApplicationMessage { get; set; }
///
/// Gets the cancellation token which can indicate that the client connection gets down.
///
public CancellationToken CancellationToken { get; }
///
/// Gets the client identifier.
/// Hint: This identifier needs to be unique over all used clients / devices on the broker to avoid connection issues.
///
public string ClientId { get; }
public bool CloseConnection { get; set; }
///
/// Gets or sets whether the publish should be processed internally.
///
public bool ProcessPublish { get; set; } = true;
///
/// Gets the response which will be sent to the client via the PUBACK etc. packets.
///
public PublishResponse Response { get; } = new PublishResponse();
///
/// Gets or sets a key/value collection that can be used to share data within the scope of this session.
///
public IDictionary SessionItems { get; }
}
}