Logo Decentralized Social Network

Events

Moera client may connect to WebSockets endpoint of a node to receive events about everything happening at the node right now: new and updated posts, changed settings etc. This allows client to be more responsive. Typically, the client connects to the home node (authentication token is required) and to the node the user views at the moment.

Moera uses STOMP protocol with several additional headers. Any STOMP client should be compatible.

Connecting

Client opens a WebSockets connection to the endpoint located at /events under Moera API root. Then it sends CONNECTED STOMP frame with the following headers:

  • accept-version: – as per STOMP specification;
  • host: – is required to differentiate between virtual domains at the same server;
  • token:authentication token, if available
  • heart-beat: – recommended, as per STOMP specification.

Subscribing

After successful connection, the client sends SUBSCRIBE STOMP frame with the following headers:

  • id: – as per STOMP specification;
  • destination: /user/queue – required;
  • seen: <queueStartedAt>,<lastEvent> – in the case of reconnection, the client tells the node the queue timestamp and the number of the last event it received from this node. If possible, the node resends all events that the client lost while being disconnected.

Event packet

Events are sent to the client in MESSAGE frames. Each frame contains event packet in JSON form with the following fields:

Type Field Comment
timestamp queueStartedAt The timestamp of the moment when the current event queue was created on the node side. This value is typically changed when the node is restarted. In this case, event numbers start again from 0, but a combination with the queue timestamp makes them unique.
int ordinal The event ordinal number.
timestamp sentAt The event timestamp.
String cid The client ID. If the event was created as a result of processing a REST API request of some client, this field will contain a copy of cid parameter passed with the request. This mechanism allows the client to know that the event is a result of processing its own request. Usually such events are ignored, because they contain information already known to the client.
Event event The event structure itself, see below.

Event

The event structure consists of type field, containing the type of the event and zero or more additional fields, containing more detailed information. See their description below.

Events typically contain minimal amount of information. Since many events are not relevant to the client and are ignored, including too much information would be a waste of traffic. The client may make a REST API request, if needed.

ASK_SUBJECTS_CHANGED

the list of requests to the node owner, that are accepted by the node, was changed.

AVATAR_ADDED

An avatar was added.

Type Field Comment
AvatarInfo avatar the avatar

AVATAR_DELETED

An avatar was deleted.

Type Field Comment
String id ID of the avatar
String mediaId ID of the media file

AVATAR_ORDERED

An avatar was assigned a new ordinal.

Type Field Comment
String id ID of the avatar
String mediaId ID of the media file
int ordinal ordinal of the avatar

BLOCKED_BY_USER_ADDED

A node has blocked the user.

Type Field Comment
BlockedByUserInfo blockedByUser information about the blocking

BLOCKED_BY_USER_DELETED

A node has unblocked the user.

Type Field Comment
BlockedByUserInfo blockedByUser information about the blocking

BLOCKED_INSTANT_ADDED

Blocking of an instant was added.

Type Field Comment
BlockedInstantInfo blockedInstant information about the blocking

BLOCKED_INSTANT_DELETED

Blocking of an instant was deleted.

Type Field Comment
BlockedInstantInfo blockedInstant information about the blocking

BLOCKED_USER_ADDED

Blocked a node.

Type Field Comment
BlockedUserInfo blockedUser information about the blocking

BLOCKED_USER_DELETED

Unblocked a node.

Type Field Comment
BlockedUserInfo blockedUser information about the blocking

CLIENT_SETTINGS_CHANGED

Some client settings were changed.

COMMENT_ADDED

A comment was added.

Type Field Comment
String id the comment ID
String postingId the posting ID
int moment moment of the comment

COMMENT_DELETED

A comment was added.

Type Field Comment
String id the comment ID
String postingId the posting ID
int moment moment of the comment

COMMENT_REACTIONS_CHANGED

Reactions to a comment were changed.

Type Field Comment
String id the comment ID
String postingId the posting ID
int moment moment of the comment

COMMENT_UPDATED

A comment was deleted.

Type Field Comment
String id the comment ID
String postingId the posting ID
int moment moment of the comment

DELETE_NODE_STATUS_UPDATED

Status of a request to delete the node was changed.

Type Field Comment
boolean requested true if the request was sent, false otherwise

DRAFT_ADDED

A draft was added.

Type Field Comment
String id
String draftType type of the draft (see DraftType for the list of possible values)
String receiverName name of the node the draft is related to
String receiverPostingId ID of the posting, set for all types, except new-posting
String receiverCommentId ID of the comment, set for comment-update type

DRAFT_DELETED

A draft was deleted.

Type Field Comment
String id
String draftType type of the draft (see DraftType for the list of possible values)
String receiverName name of the node the draft is related to
String receiverPostingId ID of the posting, set for all types, except new-posting
String receiverCommentId ID of the comment, set for comment-update type

DRAFT_UPDATED

A draft was updated.

Type Field Comment
String id
String draftType type of the draft (see DraftType for the list of possible values)
String receiverName name of the node the draft is related to
String receiverPostingId ID of the posting, set for all types, except new-posting
String receiverCommentId ID of the comment, set for comment-update type

FEED_SHERIFF_DATA_UPDATED

Supervising sheriff or sheriff marks of a feed were updated

Type Field Comment
String feedName name of the feed
String[] sheriffs (optional) list of sheriffs supervising the feed
SheriffMark[] sheriffMarks (optional) list of sheriff marks on the feed

FEED_STATUS_UPDATED

Status of a feed was updated.

Type Field Comment
String feedName name of the feed
FeedStatus status status of the feed

FRIEND_GROUP_ADDED

A group of friends was added

Type Field Comment
FriendGroupInfo friendGroup the group of friends

FRIEND_GROUP_DELETED

A group of friends was deleted

Type Field Comment
String friendGroupId ID of the group of friends

FRIEND_GROUP_UPDATED

A group of friends was updated

Type Field Comment
FriendGroupInfo friendGroup the group of friends

FRIENDSHIP_UPDATED

Friendship status of a node was updated

Type Field Comment
FriendInfo friend friendship information

GRANT_UPDATED

Administrative permissions granted to a node were updated

Type Field Comment
GrantInfo grant the updated permissions

NODE_NAME_CHANGED

The name of the node or one or more of important profile fields were changed.

Type Field Comment
String name the new name
String fullName (optional) the new full name
String gender (optional) the new node owners's gender
String title (optional) the new node title
AvatarImage avatar (optional) the new avatar

NODE_SETTINGS_CHANGED

Some node settings were changed.

NODE_SETTINGS_META_CHANGED

Some node settings metadata was changed.

PING

Sent periodically to verify status of WebSockets connection.

PLUGINS_UPDATED

The list of active plugins was updated.

POSTING_ADDED

A posting was added.

Type Field Comment
String id the posting ID

POSTING_COMMENTS_CHANGED

Comments to a posting were changed.

Type Field Comment
String id the posting ID
int total the current number of comments

POSTING_DELETED

A posting was deleted.

Type Field Comment
String id the posting ID

POSTING_REACTIONS_CHANGED

Reactions to a posting were changed.

Type Field Comment
String id the posting ID

POSTING_RESTORED

A deleted posting was restored.

Type Field Comment
String id the posting ID

POSTING_UPDATED

A posting was updated.

Type Field Comment
String id the posting ID

PROFILE_UPDATED

Profile was updated.

REGISTERED_NAME_OPERATION_STATUS

Status of an operation on the registered name of the node was changed.

REMOTE_COMMENT_ADDED

This node added a comment on a remote node

Type Field Comment
String remoteNodeName the remote node name
String remotePostingId the remote posting ID
String remoteCommentId the remote comment ID

REMOTE_COMMENT_DELETED

This node deleted a comment on a remote node

Type Field Comment
String remoteNodeName the remote node name
String remotePostingId the remote posting ID
String remoteCommentId the remote comment ID

REMOTE_COMMENT_UPDATED

This node updated a comment on a remote node

Type Field Comment
String remoteNodeName the remote node name
String remotePostingId the remote posting ID
String remoteCommentId the remote comment ID

REMOTE_COMMENT_VERIFICATION_FAILED

Verification of the signature of a comment on a remote node failed.

Type Field Comment
String id asynchronous operation ID
String nodeName the remote node name
String postingId the posting ID
String commentId the comment ID
String errorCode error code
String errorMessage error message

REMOTE_COMMENT_VERIFIED

Signature of a comment on a remote node was verified.

Type Field Comment
String id asynchronous operation ID
String nodeName the remote node name
String postingId the posting ID
String commentId the comment ID
boolean correct verification result

REMOTE_FRIENDSHIP_UPDATED

Friendship status of the user on a remote node was updated

Type Field Comment
FriendOfInfo friendOf remote node friendship information

REMOTE_NODE_AVATAR_CHANGED

Avatar of a remote node was changed.

Type Field Comment
String name the remote node name
AvatarImage avatar (optional) the remote node avatar

REMOTE_NODE_FULL_NAME_CHANGED

Name of a remote node was changed.

Type Field Comment
String name the remote node name
String fullName (optional) the remote node full name

REMOTE_POSTING_ADDED

Type Field Comment
String remoteNodeName the remote node name
String remotePostingId the posting ID

REMOTE_POSTING_DELETED

Type Field Comment
String remoteNodeName the remote node name
String remotePostingId the posting ID

REMOTE_POSTING_UPDATED

Type Field Comment
String remoteNodeName the remote node name
String remotePostingId the posting ID

REMOTE_POSTING_VERIFICATION_FAILED

Verification of the signature of a posting on a remote node failed.

Type Field Comment
String id asynchronous operation ID
String nodeName the remote node name
String receiverName the posting receiver name
String postingId the posting ID
String revisionId the posting revision ID
String errorCode error code
String errorMessage error message

REMOTE_POSTING_VERIFIED

Signature of a posting on a remote node was verified.

Type Field Comment
String id asynchronous operation ID
String nodeName the remote node name
String receiverName the posting receiver name
String postingId the posting ID
String revisionId the posting revision ID
boolean correct verification result

REMOTE_REACTION_ADDED

This node added a reaction on a remote node

Type Field Comment
String remoteNodeName the remote node name
String remotePostingId the remote posting ID
boolean negative true if the reaction is negative, false if positive
int emoji reaction code, usually interpreted by clients as emoji code point
timestamp createdAt reaction creation timestamp - the real time when the reaction was created

REMOTE_REACTION_DELETED

This node deleted a reaction on a remote node

Type Field Comment
String remoteNodeName the remote node name
String remotePostingId the remote posting ID

REMOTE_REACTION_VERIFICATION_FAILED

Verification of the signature of a reaction on a remote node failed.

Type Field Comment
String id asynchronous operation ID
String nodeName the remote node name
String postingId the posting ID
String commentId the comment ID, if any
String reactionOwnerName the reaction owner name
String errorCode error code
String errorMessage error message

REMOTE_REACTION_VERIFIED

Signature of a reaction on a remote node was verified.

Type Field Comment
String id asynchronous operation ID
String nodeName the remote node name
String postingId the posting ID
String commentId the comment ID, if any
String reactionOwnerName the reaction owner name
boolean correct verification result

SHERIFF_COMPLAINT_ADDED

A new complaint was received.

Type Field Comment
SheriffComplaintInfo complaint the complaint
String groupId ID of the group of complaints this complaint was added to

SHERIFF_COMPLAINT_GROUP_ADDED

A new group of complaints was added.

Type Field Comment
SheriffComplaintGroupInfo group the group of complaints

SHERIFF_COMPLAINT_GROUP_UPDATED

A group of complaints was updated.

Type Field Comment
SheriffComplaintGroupInfo group the group of complaints

STORIES_STATUS_UPDATED

Viewed/read status of a group of stories in a feed was changed.

Type Field Comment
String feedName name of the feed
boolean viewed (optional) new value of the viewed flag (null or absent, if the flag is not changed).
boolean read (optional) new value of the read flag (null or absent, if the flag is not changed).
int before flags for all stories before this moment, inclusive were changed.

STORY_ADDED

A story was created.

Type Field Comment
String id
String storyType type of the story (see StoryType for the list of possible values)
String feedName name of the feed
timestamp publishedAt story publication timestamp - the time the story is published under in the feed
boolean pinned true if the story is pinned (should appear before any non-pinned story in the feed), false otherwise
int moment
String postingId (optional) ID of the posting this story is about
boolean viewed (optional) (admin only) true if the story has been viewed by node owner, false otherwise
boolean read (optional) (admin only) true if the story has been read by node owner, false otherwise
boolean satisfied (optional) (admin only) if the story is associated with a user action (for example, it contains a form that should be submitted), this flag is set to true if the action is done already, and false otherwise
String summaryNodeName (optional) name of the node related to the summary of the story
String summaryFullName (optional) full name of the node related to the summary of the story
AvatarImage summaryAvatar (optional) avatar of the summary of the story
String summary (optional) user-readable summary of the story - this field is deprecated in favor of summaryData
StorySummaryData summaryData (optional) details of the story; they are used by the client to build a user-readable summary of the story
String remoteNodeName (optional) name of the node this story is about
String remoteFullName (optional) full name of the node this story is about
String remotePostingId (optional) ID of the posting at remote node this story is about
String remoteCommentId (optional) ID of the comment at remote node this story is about
StoryOperations operations (optional) list of the supported operations and the corresponding principals

STORY_DELETED

A story was deleted.

Type Field Comment
String id
String storyType type of the story (see StoryType for the list of possible values)
String feedName name of the feed
int moment
String postingId (optional) ID of the posting this story is about

STORY_UPDATED

A story was updated.

Type Field Comment
String id
String storyType type of the story (see StoryType for the list of possible values)
String feedName name of the feed
timestamp publishedAt story publication timestamp - the time the story is published under in the feed
boolean pinned true if the story is pinned (should appear before any non-pinned story in the feed), false otherwise
int moment
String postingId (optional) ID of the posting this story is about
boolean viewed (optional) (admin only) true if the story has been viewed by node owner, false otherwise
boolean read (optional) (admin only) true if the story has been read by node owner, false otherwise
boolean satisfied (optional) (admin only) if the story is associated with a user action (for example, it contains a form that should be submitted), this flag is set to true if the action is done already, and false otherwise
String summaryNodeName (optional) name of the node related to the summary of the story
String summaryFullName (optional) full name of the node related to the summary of the story
AvatarImage summaryAvatar (optional) avatar of the summary of the story
String summary (optional) user-readable summary of the story - this field is deprecated in favor of summaryData
StorySummaryData summaryData (optional) details of the story; they are used by the client to build a user-readable summary of the story
String remoteNodeName (optional) name of the node this story is about
String remoteFullName (optional) full name of the node this story is about
String remotePostingId (optional) ID of the posting at remote node this story is about
String remoteCommentId (optional) ID of the comment at remote node this story is about
StoryOperations operations (optional) list of the supported operations and the corresponding principals

SUBSCRIBED

Sent immediately after subscribing to update the client about the current queue state and its STOMP session ID.

Type Field Comment
String sessionId STOMP session ID

SUBSCRIBER_ADDED

A node subscribed to notifications from this node.

Type Field Comment
SubscriberInfo subscriber subscriber information

SUBSCRIBER_DELETED

A node unsubscribed from notifications from this node.

Type Field Comment
SubscriberInfo subscriber subscriber information

SUBSCRIBER_UPDATED

Subscriber information was updated.

Type Field Comment
SubscriberInfo subscriber subscriber information

SUBSCRIBERS_TOTAL_CHANGED

Number of subscribers was changed.

Type Field Comment
int feedSubscribersTotal total number of subscribers of the node

SUBSCRIPTION_ADDED

This node has subscribed to notifications from a remote node.

Type Field Comment
SubscriptionInfo subscription subscription information

SUBSCRIPTION_DELETED

This node has unsubscribed from notifications from a remote node.

Type Field Comment
SubscriptionInfo subscription subscription information

SUBSCRIPTION_UPDATED

Subscription information was updated.

Type Field Comment
SubscriptionInfo subscription subscription information

SUBSCRIPTIONS_TOTAL_CHANGED

Numbers of subscriptions was changed.

Type Field Comment
int feedSubscriptionsTotal total number of subscriptions of the node

TOKEN_ADDED

A token was created.

Type Field Comment
TokenInfo token token information

TOKEN_DELETED

A token was deleted.

Type Field Comment
String id ID of the token

TOKEN_UPDATED

A token was updated.

Type Field Comment
TokenInfo token token information