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.
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 availableheart-beat:
– recommended, as per STOMP specification.
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.
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. |
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.
the list of requests to the node owner, that are accepted by the node, was changed.
An avatar was added.
Type | Field | Comment |
---|---|---|
AvatarInfo
|
avatar |
the avatar |
An avatar was deleted.
Type | Field | Comment |
---|---|---|
String
|
id |
ID of the avatar |
String
|
mediaId |
ID of the media file |
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 |
A node has blocked the user.
Type | Field | Comment |
---|---|---|
BlockedByUserInfo
|
blockedByUser |
information about the blocking |
A node has unblocked the user.
Type | Field | Comment |
---|---|---|
BlockedByUserInfo
|
blockedByUser |
information about the blocking |
Blocking of an instant was added.
Type | Field | Comment |
---|---|---|
BlockedInstantInfo
|
blockedInstant |
information about the blocking |
Blocking of an instant was deleted.
Type | Field | Comment |
---|---|---|
BlockedInstantInfo
|
blockedInstant |
information about the blocking |
Blocked a node.
Type | Field | Comment |
---|---|---|
BlockedUserInfo
|
blockedUser |
information about the blocking |
Unblocked a node.
Type | Field | Comment |
---|---|---|
BlockedUserInfo
|
blockedUser |
information about the blocking |
Some client settings were changed.
A comment was added.
Type | Field | Comment |
---|---|---|
String
|
id |
the comment ID |
String
|
postingId |
the posting ID |
int
|
moment |
moment of the comment |
A comment was added.
Type | Field | Comment |
---|---|---|
String
|
id |
the comment ID |
String
|
postingId |
the posting ID |
int
|
moment |
moment of the comment |
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 |
A comment was deleted.
Type | Field | Comment |
---|---|---|
String
|
id |
the comment ID |
String
|
postingId |
the posting ID |
int
|
moment |
moment of the comment |
Status of a request to delete the node was changed.
Type | Field | Comment |
---|---|---|
boolean
|
requested |
true if the request was sent, false otherwise
|
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
|
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
|
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
|
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 |
Status of a feed was updated.
Type | Field | Comment |
---|---|---|
String
|
feedName |
name of the feed |
FeedStatus
|
status |
status of the feed |
A group of friends was added
Type | Field | Comment |
---|---|---|
FriendGroupInfo
|
friendGroup |
the group of friends |
A group of friends was deleted
Type | Field | Comment |
---|---|---|
String
|
friendGroupId |
ID of the group of friends |
A group of friends was updated
Type | Field | Comment |
---|---|---|
FriendGroupInfo
|
friendGroup |
the group of friends |
Friendship status of a node was updated
Type | Field | Comment |
---|---|---|
FriendInfo
|
friend |
friendship information |
Administrative permissions granted to a node were updated
Type | Field | Comment |
---|---|---|
GrantInfo
|
grant |
the updated permissions |
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 |
Some node settings were changed.
Some node settings metadata was changed.
Sent periodically to verify status of WebSockets connection.
The list of active plugins was updated.
A posting was added.
Type | Field | Comment |
---|---|---|
String
|
id |
the posting ID |
Comments to a posting were changed.
Type | Field | Comment |
---|---|---|
String
|
id |
the posting ID |
int
|
total |
the current number of comments |
A posting was deleted.
Type | Field | Comment |
---|---|---|
String
|
id |
the posting ID |
Reactions to a posting were changed.
Type | Field | Comment |
---|---|---|
String
|
id |
the posting ID |
A deleted posting was restored.
Type | Field | Comment |
---|---|---|
String
|
id |
the posting ID |
A posting was updated.
Type | Field | Comment |
---|---|---|
String
|
id |
the posting ID |
Profile was updated.
Status of an operation on the registered name of the node was changed.
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 |
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 |
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 |
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 |
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 |
Friendship status of the user on a remote node was updated
Type | Field | Comment |
---|---|---|
FriendOfInfo
|
friendOf |
remote node friendship information |
Avatar of a remote node was changed.
Type | Field | Comment |
---|---|---|
String
|
name |
the remote node name |
AvatarImage
|
avatar |
(optional) the remote node avatar |
Name of a remote node was changed.
Type | Field | Comment |
---|---|---|
String
|
name |
the remote node name |
String
|
fullName |
(optional) the remote node full name |
Type | Field | Comment |
---|---|---|
String
|
remoteNodeName |
the remote node name |
String
|
remotePostingId |
the posting ID |
Type | Field | Comment |
---|---|---|
String
|
remoteNodeName |
the remote node name |
String
|
remotePostingId |
the posting ID |
Type | Field | Comment |
---|---|---|
String
|
remoteNodeName |
the remote node name |
String
|
remotePostingId |
the posting ID |
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 |
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 |
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 |
This node deleted a reaction on a remote node
Type | Field | Comment |
---|---|---|
String
|
remoteNodeName |
the remote node name |
String
|
remotePostingId |
the remote posting ID |
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 |
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 |
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 |
A new group of complaints was added.
Type | Field | Comment |
---|---|---|
SheriffComplaintGroupInfo
|
group |
the group of complaints |
A group of complaints was updated.
Type | Field | Comment |
---|---|---|
SheriffComplaintGroupInfo
|
group |
the group of complaints |
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. |
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 |
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 |
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 |
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 |
A node subscribed to notifications from this node.
Type | Field | Comment |
---|---|---|
SubscriberInfo
|
subscriber |
subscriber information |
A node unsubscribed from notifications from this node.
Type | Field | Comment |
---|---|---|
SubscriberInfo
|
subscriber |
subscriber information |
Subscriber information was updated.
Type | Field | Comment |
---|---|---|
SubscriberInfo
|
subscriber |
subscriber information |
Number of subscribers was changed.
Type | Field | Comment |
---|---|---|
int
|
feedSubscribersTotal |
total number of subscribers of the node |
This node has subscribed to notifications from a remote node.
Type | Field | Comment |
---|---|---|
SubscriptionInfo
|
subscription |
subscription information |
This node has unsubscribed from notifications from a remote node.
Type | Field | Comment |
---|---|---|
SubscriptionInfo
|
subscription |
subscription information |
Subscription information was updated.
Type | Field | Comment |
---|---|---|
SubscriptionInfo
|
subscription |
subscription information |
Numbers of subscriptions was changed.
Type | Field | Comment |
---|---|---|
int
|
feedSubscriptionsTotal |
total number of subscriptions of the node |
A token was created.
Type | Field | Comment |
---|---|---|
TokenInfo
|
token |
token information |
A token was deleted.
Type | Field | Comment |
---|---|---|
String
|
id |
ID of the token |
A token was updated.
Type | Field | Comment |
---|---|---|
TokenInfo
|
token |
token information |