mirror of
https://github.com/mochi-mqtt/server.git
synced 2025-10-05 16:17:01 +08:00
Update Hooks List
This commit is contained in:
@@ -37,7 +37,7 @@ import "github.com/mochi-co/mqtt/v2"
|
|||||||
- Plus all the original MQTT features of Mochi MQTT v1, such as Full QoS(0,1,2), $SYS topics, retained messages, etc.
|
- Plus all the original MQTT features of Mochi MQTT v1, such as Full QoS(0,1,2), $SYS topics, retained messages, etc.
|
||||||
- Developer-centric:
|
- Developer-centric:
|
||||||
- Most core broker code is now exported and accessible, for total developer control.
|
- Most core broker code is now exported and accessible, for total developer control.
|
||||||
- Full featured and flexible Hook-based interfacing system to provide easy 'plugin' development.
|
- Full-featured and flexible Hook-based interfacing system to provide easy 'plugin' development.
|
||||||
- Direct Packet Injection using special inline client, or masquerade as existing clients.
|
- Direct Packet Injection using special inline client, or masquerade as existing clients.
|
||||||
- Performant and Stable:
|
- Performant and Stable:
|
||||||
- Our classic trie-based Topic-Subscription model.
|
- Our classic trie-based Topic-Subscription model.
|
||||||
@@ -278,13 +278,13 @@ The function signatures for all the hooks and `mqtt.Hook` interface can be found
|
|||||||
> The most flexible event hooks are OnPacketRead, OnPacketEncode, and OnPacketSent - these hooks be used to control and modify all incoming and outgoing packets.
|
> The most flexible event hooks are OnPacketRead, OnPacketEncode, and OnPacketSent - these hooks be used to control and modify all incoming and outgoing packets.
|
||||||
|
|
||||||
| Function | Usage |
|
| Function | Usage |
|
||||||
| -------------------------- | -- |
|
|------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| OnStarted | Called when the server has successfully started. |
|
| OnStarted | Called when the server has successfully started. |
|
||||||
| OnStopped | Called when the server has successfully stopped. |
|
| OnStopped | Called when the server has successfully stopped. |
|
||||||
| OnConnectAuthenticate | Called when a user attempts to authenticate with the server. An implementation of this method MUST be used to allow or deny access to the server (see hooks/auth/allow_all or basic). It can be used in custom hooks to check connecting users against an existing user database. Returns true if allowed. |
|
| OnConnectAuthenticate | Called when a user attempts to authenticate with the server. An implementation of this method MUST be used to allow or deny access to the server (see hooks/auth/allow_all or basic). It can be used in custom hooks to check connecting users against an existing user database. Returns true if allowed. |
|
||||||
| OnACLCheck | Called when a user attempts to publish or subscribe to a topic filter. As above. |
|
| OnACLCheck | Called when a user attempts to publish or subscribe to a topic filter. As above. |
|
||||||
| OnSysInfoTick | Called when the $SYS topic values are published out. |
|
| OnSysInfoTick | Called when the $SYS topic values are published out. |
|
||||||
| OnConnect | Called when a new client connects |
|
| OnConnect | Called when a new client connects, may return an error or packet code to halt the client connection process. |
|
||||||
| OnSessionEstablished | Called when a new client successfully establishes a session (after OnConnect) |
|
| OnSessionEstablished | Called when a new client successfully establishes a session (after OnConnect) |
|
||||||
| OnDisconnect | Called when a client is disconnected for any reason. |
|
| OnDisconnect | Called when a client is disconnected for any reason. |
|
||||||
| OnAuthPacket | Called when an auth packet is received. It is intended to allow developers to create their own mqtt v5 Auth Packet handling mechanisms. Allows packet modification. |
|
| OnAuthPacket | Called when an auth packet is received. It is intended to allow developers to create their own mqtt v5 Auth Packet handling mechanisms. Allows packet modification. |
|
||||||
@@ -301,6 +301,7 @@ The function signatures for all the hooks and `mqtt.Hook` interface can be found
|
|||||||
| OnPublished | Called when a client has published a message to subscribers. |
|
| OnPublished | Called when a client has published a message to subscribers. |
|
||||||
| OnPublishDropped | Called when a message to a client is dropped before delivery, such as if the client is taking too long to respond. |
|
| OnPublishDropped | Called when a message to a client is dropped before delivery, such as if the client is taking too long to respond. |
|
||||||
| OnRetainMessage | Called then a published message is retained. |
|
| OnRetainMessage | Called then a published message is retained. |
|
||||||
|
| OnRetainPublished | Called then a retained message is published to a client. |
|
||||||
| OnQosPublish | Called when a publish packet with Qos >= 1 is issued to a subscriber. |
|
| OnQosPublish | Called when a publish packet with Qos >= 1 is issued to a subscriber. |
|
||||||
| OnQosComplete | Called when the Qos flow for a message has been completed. |
|
| OnQosComplete | Called when the Qos flow for a message has been completed. |
|
||||||
| OnQosDropped | Called when an inflight message expires before completion. |
|
| OnQosDropped | Called when an inflight message expires before completion. |
|
||||||
|
Reference in New Issue
Block a user