struct Athena::Mercure::Update

Overview

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.

Defined in:

update.cr

Constructors

Instance Method Summary

Constructor Detail

def self.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]

Instance Method Detail

def data : String #

Returns the string content of the update.


[View source]
def id : String | Nil #

Maps to the SSE's id property.


[View source]
def private? : Bool #

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


[View source]
def retry : Int32 | Nil #

Maps to the SSE's retry property


[View source]
def topics : Array(String) #

Returns the identifiers this update is associated with.


[View source]
def type : String | Nil #

Maps to the SSE's event property


[View source]