Documentation
¶
Index ¶
- func HandleMqttConnection(conn net.Conn, ctx *ServerContext)
- type ConnectedClient
- type MqttBase
- type MqttHandler
- type ServerContext
- func (ctx *ServerContext) AddClient(conn io.Writer, connect *packets.Connect) (code byte, sessionExists bool, maxQos byte)
- func (ctx *ServerContext) Disconnect(conn io.Writer, disconnect *packets.Disconnect)
- func (ctx *ServerContext) FreePacketID(conn io.Writer, pubRel *packets.Pubrel) error
- func (ctx *ServerContext) Publish(publish *packets.Publish)
- func (ctx *ServerContext) ReservePacketID(conn io.Writer, publish *packets.Publish) error
- func (ctx *ServerContext) Subscribe(conn io.Writer, subscribe *packets.Subscribe) []byte
- func (ctx *ServerContext) Unsubscribe(conn io.Writer, unsubscribe *packets.Unsubscribe) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleMqttConnection ¶
func HandleMqttConnection(conn net.Conn, ctx *ServerContext)
Types ¶
type ConnectedClient ¶
type ConnectedClient struct { Connection io.Writer ClientID string ClientGroup string IsConnected bool IsClean bool Subscriptions map[string]packets.SubOptions }
ConnectedClient stores the information about a currently connected client
type MqttBase ¶
type MqttBase interface { AddClient(io.Writer, *packets.Connect) (reasonCode byte, sessionExists bool, maxQos byte) Disconnect(io.Writer, *packets.Disconnect) Publish(*packets.Publish) Subscribe(io.Writer, *packets.Subscribe) []byte Unsubscribe(io.Writer, *packets.Unsubscribe) []byte ReservePacketID(io.Writer, *packets.Publish) error FreePacketID(io.Writer, *packets.Pubrel) error }
type MqttHandler ¶
type MqttHandler struct {
// contains filtered or unexported fields
}
func (*MqttHandler) Handle ¶
func (handler *MqttHandler) Handle(readWriter io.ReadWriter)
type ServerContext ¶
type ServerContext struct {
// contains filtered or unexported fields
}
ServerContext stores the state of the cluster node
func NewServerContext ¶
NewServerContext creates a new server context.
This should only be called once per cluster node.
func (*ServerContext) Disconnect ¶
func (ctx *ServerContext) Disconnect(conn io.Writer, disconnect *packets.Disconnect)
func (*ServerContext) FreePacketID ¶
func (*ServerContext) Publish ¶
func (ctx *ServerContext) Publish(publish *packets.Publish)
Publish publishes a message to a topic
func (*ServerContext) ReservePacketID ¶
func (*ServerContext) Unsubscribe ¶
func (ctx *ServerContext) Unsubscribe(conn io.Writer, unsubscribe *packets.Unsubscribe) []byte
Click to show internal directories.
Click to hide internal directories.