Skip to content

struct Athena::Mercure::Update
inherits Struct #

Represents an update to publish.

AMC::Update.new(
  "https://example.com/books/1",
  {status: "OutOfStock"}.to_json
)

The topic may be any string, but is recommended it be an IRI (Internationalized Resource Identifier) that uniquely identifies the resource the update related to. The data may also be any string, but will most commonly be JSON.

Private Updates#

By default, an update would be sent to all subscribers listening on that topic. However, if private: true is defined on the update, then it'll only be sent to subscribers who are authorized to receive it. See Authorization for more information.

Constructors#

.new(topics : String | Array(String), data : String = "", private __arg0 : Bool = false, id : String | Nil = nil, type : String | Nil = nil, retry : Int32 | Nil = nil)#

View source

Methods#

#data : String#

Returns the string content of the update.

View source

#id : String | ::Nil#

Maps to the SSE's id property.

View source

#private? : Bool#

If true, the update will not be sent to subscribers who are not authorized to receive it.

View source

#retry : Int32 | ::Nil#

Maps to the SSE's retry property

View source

#topics : Array(String)#

Returns the identifiers this update is associated with.

View source

#type : String | ::Nil#

Maps to the SSE's event property

View source