EphemeralMessage: {
    count: number;
    data: Uint8Array;
    documentId: DocumentId;
    senderId: PeerId;
    sessionId: SessionId;
    targetId: PeerId;
    type: "ephemeral";
}

An ephemeral message.

Type declaration

  • count: number

    A sequence number which must be incremented for each message sent by this peer.

  • data: Uint8Array

    The actual data of the message.

  • documentId: DocumentId

    The document ID this message pertains to.

  • senderId: PeerId
  • sessionId: SessionId

    The ID of the session this message is part of. The sequence number for a given session always increases.

  • targetId: PeerId
  • type: "ephemeral"

Remarks

Ephemeral messages are not persisted anywhere. The data property can be used by the application as needed. The repo gossips these around.

In order to avoid infinite loops of ephemeral messages, every message has (a) a session ID, which is a random number generated by the sender at startup time; and (b) a sequence number. The combination of these two things allows us to discard messages we have already seen.