-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RPC with inline client #428
Comments
You can use server.InjectPacket to have full control over the packet properties. In fact, server.Publish just creates the packet and calls InjectPacket. Lines 753 to 768 in 830de14
|
Yes, but Maybe add a new publish function like it is implemented in |
You do not need to use that inlineClient to publish. In fact, prior to introduction of inlineClient for subscription, a new inlineClient is created for every call to Publish. cl := s.NewClient(nil, "local", "inline", true)
return s.InjectPacket(cl, packets.Packet{ |
My suggestion is to do something like this: type PublishRequest struct {
Retain bool
Qos byte
Topic string
Payload []byte
Properties packets.Properties
}
func (s *Server) PublishV2(request *PublishRequest) error {
if !s.Options.InlineClient {
return ErrInlineClientNotEnabled
}
return s.InjectPacket(s.inlineClient, packets.Packet{
FixedHeader: packets.FixedHeader{
Type: packets.Publish,
Retain: request.Retain,
Qos: request.Qos,
},
TopicName: request.Topic,
Payload: request.Payload,
PacketID: uint16(request.Qos),
Properties: request.Properties,
})
} |
@vitalvas Given @thedevop's explanation, I don't think we need a
|
Hello,
I'm trying to use a library to implement RPC (client-server architecture, mqtt is used as a transport instead of http).
I encountered the following problem - the "server.Publish" function does not have the ability to set
Properties
.An example of what I need with
paho.golang
:The text was updated successfully, but these errors were encountered: