Giter Club home page Giter Club logo

Comments (3)

Florimond avatar Florimond commented on July 29, 2024 1

Actually, Emitter supports QoS 1. But maybe not in the way you are expecting. The code that acknowledges the publication of a message is in conn.go

// Acknowledge the publication
if packet.Header.QOS > 0 {
	ack := mqtt.Puback{MessageID: packet.MessageID}
	if _, err := ack.EncodeTo(c.socket); err != nil {
		return err
	}
}

However, what is acknowledged is that the message has been integrated into Emitter. Not that it arrived to any client. There could be no client listening at this moment and for a long time, if ever. Although there are certainly more or less elegant ways to handle such cases in a pub/sub system, it didn't seem important for an AP platform like Emitter. The same goes for QoS 2, and it's actually even harder to enforce.

Emitter focusing on AP, I like to compare it to the UDP of pub/sub systems. If you want stronger guarantees you'll have to implement a protocol on top of Emitter.

In the current state of Emitter, I must admit I don't see how your client could receive the same message twice. But if you want to make sure, you can handle this quite easily on the client side by using a tombstone.

@qiulin @mkozjak @kelindar

from emitter.

qiulin avatar qiulin commented on July 29, 2024

It seems only support QoS 0.

// Send forwards the message to the underlying client.
func (c *Conn) Send(m *message.Message) (err error) {
	defer c.MeasureElapsed("send.pub", time.Now())
	packet := mqtt.Publish{
		Header:  mqtt.Header{QOS: 0},
		Topic:   m.Channel, // The channel for this message.
		Payload: m.Payload, // The payload for this message.
	}

	_, err = packet.EncodeTo(c.socket)
	return
}

from emitter.

mkozjak avatar mkozjak commented on July 29, 2024

@kelindar - Maybe any plans on supporting QoS level 1 and/or 2? If not, what is the recommendation in order to get the Exactly Once message guarantee-like behavior? Thanks!

from emitter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.