Show:

Streams.Message.Total Class

Methods related to working with messageTotals of different message types in a stream

Item Index

Methods

Methods

get

(
  • publisherId
  • streamName
  • messageType
  • callback
)
static

Get one or more messageTotals, which may result in batch requests to the server. May call Streams.Message.Total.get.onError if an error occurs.

Parameters:

  • publisherId String
  • streamName String
  • messageType String | Array

    can be the message type, or an array of them

  • callback Function

    This receives two parameters. The first is the error. If messageType was a String, then the second parameter is the messageTotal. If messageType was an Array, then the second parameter is a hash of {messageType: messageTotal} pairs

latest

(
  • publisherId
  • streamName
  • messageType
)
Integer | Null static

Returns the latest total number of messages (of a certain type) posted to the stream

Parameters:

Returns:

Integer | Null:

setUpElement

(
  • element
  • publisherId
  • streamName
  • messageType
  • key
  • [options]
)
static

Sets up an element to show the total number of unseen messages (of a certain type) from a stream, and update the display in real time.

Parameters:

  • element Element

    The element to set up

  • publisherId String

    The id of the publisher

  • streamName String

    The stream name

  • messageType String

    The type of the message

  • key String | Q.Tool | True

    Key for attaching the events

  • [options] Object optional
    • [unseenClass] String optional

      Added if there is at least one unseen message

unseen

(
  • publisherId
  • streamName
  • messageType
)
Integer | Null static

Returns the latest number of unseen messages (of a certain type) posted to the stream

Parameters:

  • publisherId String

    id of the user publishing the straem

  • streamName String

    the name of the stream

  • messageType String

    the type of the messages

Returns:

Integer | Null:

Returns the number of unseen messages if there is a latest messageTotal, otherwise null.

Events

get.onError

Occurs when MTotal.get encounters an error loading a messageTotal from the server

onSeen

Occurs when MTotal.seen is called to update the number of seen messages. The first parameter passed is the new messageTotal.

Event Payload: