Class MqttServer
public class MqttServer : Disposable, IDisposable
- Inheritance
-
MqttServer
- Implements
- Inherited Members
- Extension Methods
Constructors
MqttServer(MqttServerOptions, IEnumerable<IMqttServerAdapter>, IMqttNetLogger)
public MqttServer(MqttServerOptions options, IEnumerable<IMqttServerAdapter> adapters, IMqttNetLogger logger)
Parameters
options
MqttServerOptionsadapters
IEnumerable<IMqttServerAdapter>logger
IMqttNetLogger
Properties
AcceptNewConnections
Gets or sets whether the server will accept new connections. If not, the server will close the connection without any notification (DISCONNECT packet). This feature can be used when the server is shutting down.
public bool AcceptNewConnections { get; set; }
Property Value
IsStarted
public bool IsStarted { get; }
Property Value
ServerSessionItems
Gives access to the session items which belong to this server. This session items are passed to several events instead of the client session items if the event is caused by the server instead of a client.
public IDictionary ServerSessionItems { get; }
Property Value
Methods
DeleteRetainedMessagesAsync()
public Task DeleteRetainedMessagesAsync()
Returns
DisconnectClientAsync(string, MqttServerClientDisconnectOptions)
public Task DisconnectClientAsync(string id, MqttServerClientDisconnectOptions options)
Parameters
id
stringoptions
MqttServerClientDisconnectOptions
Returns
Dispose(bool)
protected override void Dispose(bool disposing)
Parameters
disposing
bool
GetClientsAsync()
public Task<IList<MqttClientStatus>> GetClientsAsync()
Returns
GetRetainedMessageAsync(string)
public Task<MqttApplicationMessage> GetRetainedMessageAsync(string topic)
Parameters
topic
string
Returns
GetRetainedMessagesAsync()
public Task<IList<MqttApplicationMessage>> GetRetainedMessagesAsync()
Returns
GetSessionsAsync()
public Task<IList<MqttSessionStatus>> GetSessionsAsync()
Returns
InjectApplicationMessage(InjectedMqttApplicationMessage, CancellationToken)
public Task InjectApplicationMessage(InjectedMqttApplicationMessage injectedApplicationMessage, CancellationToken cancellationToken = default)
Parameters
injectedApplicationMessage
InjectedMqttApplicationMessagecancellationToken
CancellationToken
Returns
StartAsync()
public Task StartAsync()
Returns
StopAsync(MqttServerStopOptions)
public Task StopAsync(MqttServerStopOptions options)
Parameters
options
MqttServerStopOptions
Returns
SubscribeAsync(string, ICollection<MqttTopicFilter>)
public Task SubscribeAsync(string clientId, ICollection<MqttTopicFilter> topicFilters)
Parameters
clientId
stringtopicFilters
ICollection<MqttTopicFilter>
Returns
UnsubscribeAsync(string, ICollection<string>)
public Task UnsubscribeAsync(string clientId, ICollection<string> topicFilters)
Parameters
clientId
stringtopicFilters
ICollection<string>
Returns
UpdateRetainedMessageAsync(MqttApplicationMessage)
public Task UpdateRetainedMessageAsync(MqttApplicationMessage retainedMessage)
Parameters
retainedMessage
MqttApplicationMessage
Returns
Events
ApplicationMessageEnqueuedOrDroppedAsync
public event Func<ApplicationMessageEnqueuedEventArgs, Task> ApplicationMessageEnqueuedOrDroppedAsync
Event Type
ApplicationMessageNotConsumedAsync
public event Func<ApplicationMessageNotConsumedEventArgs, Task> ApplicationMessageNotConsumedAsync
Event Type
ClientAcknowledgedPublishPacketAsync
public event Func<ClientAcknowledgedPublishPacketEventArgs, Task> ClientAcknowledgedPublishPacketAsync
Event Type
ClientConnectedAsync
public event Func<ClientConnectedEventArgs, Task> ClientConnectedAsync
Event Type
ClientDisconnectedAsync
public event Func<ClientDisconnectedEventArgs, Task> ClientDisconnectedAsync
Event Type
ClientSubscribedTopicAsync
public event Func<ClientSubscribedTopicEventArgs, Task> ClientSubscribedTopicAsync
Event Type
ClientUnsubscribedTopicAsync
public event Func<ClientUnsubscribedTopicEventArgs, Task> ClientUnsubscribedTopicAsync
Event Type
InterceptingClientEnqueueAsync
public event Func<InterceptingClientApplicationMessageEnqueueEventArgs, Task> InterceptingClientEnqueueAsync
Event Type
InterceptingInboundPacketAsync
public event Func<InterceptingPacketEventArgs, Task> InterceptingInboundPacketAsync
Event Type
InterceptingOutboundPacketAsync
public event Func<InterceptingPacketEventArgs, Task> InterceptingOutboundPacketAsync
Event Type
InterceptingPublishAsync
public event Func<InterceptingPublishEventArgs, Task> InterceptingPublishAsync
Event Type
InterceptingSubscriptionAsync
public event Func<InterceptingSubscriptionEventArgs, Task> InterceptingSubscriptionAsync
Event Type
InterceptingUnsubscriptionAsync
public event Func<InterceptingUnsubscriptionEventArgs, Task> InterceptingUnsubscriptionAsync
Event Type
LoadingRetainedMessageAsync
public event Func<LoadingRetainedMessagesEventArgs, Task> LoadingRetainedMessageAsync
Event Type
PreparingSessionAsync
public event Func<EventArgs, Task> PreparingSessionAsync
Event Type
QueuedApplicationMessageOverwrittenAsync
public event Func<QueueMessageOverwrittenEventArgs, Task> QueuedApplicationMessageOverwrittenAsync
Event Type
RetainedMessageChangedAsync
public event Func<RetainedMessageChangedEventArgs, Task> RetainedMessageChangedAsync
Event Type
RetainedMessagesClearedAsync
public event Func<EventArgs, Task> RetainedMessagesClearedAsync
Event Type
SessionDeletedAsync
public event Func<SessionDeletedEventArgs, Task> SessionDeletedAsync
Event Type
StartedAsync
public event Func<EventArgs, Task> StartedAsync
Event Type
StoppedAsync
public event Func<EventArgs, Task> StoppedAsync
Event Type
ValidatingConnectionAsync
public event Func<ValidatingConnectionEventArgs, Task> ValidatingConnectionAsync