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 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 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 waste of traffic. The client may make a REST API request, if needed.
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 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 |
Some client settings were changed.
A draft was added.
Type | Field | Comment |
---|---|---|
String
|
id |
|
String
|
draftType |
type of the draft (see DraftInfo.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 DraftInfo.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 DraftInfo.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 |
Status of a feed was updated.
Type | Field | Comment |
---|---|---|
String
|
feedName |
name of the feed |
FeedStatus
|
status |
status of the feed |
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 |
the new full name |
String
|
gender |
the new node owners's gender |
String
|
title |
the new node title |
AvatarImage
|
avatar |
the new avatar |
Some node settings were changed.
Some node settings metadata was changed.
People information was changed.
Type | Field | Comment |
---|---|---|
int
|
feedSubscribersTotal |
total number of subscribers of the node |
int
|
feedSubscriptionsTotal |
total number of subscriptions of the node |
Sent periodically to verify status of WebSockets connection.
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.
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 |
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 |
Avatar of a remote node was changed.
Type | Field | Comment |
---|---|---|
String
|
nodeName |
the remote node name |
AvatarImage
|
avatar |
the remote node avatar |
Name of a remote node was changed.
Type | Field | Comment |
---|---|---|
String
|
nodeName |
the remote node name |
String
|
fullName |
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 |
Viewed/read status of a group of stories in a feed was changed.
Type | Field | Comment |
---|---|---|
String
|
feedName |
name of the feed |
boolean
|
viewed |
new value of the viewed flag (null , if the flag is not changed). |
boolean
|
read |
new value of the read flag (null , 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 |
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 |
ID of the posting this story is about (may be absent) |
boolean
|
viewed |
(admin only) true , if the story has been viewed by node owner, false otherwise
|
boolean
|
read |
(admin only) true , if the story has been read by node owner, false otherwise
|
String
|
summaryNodeName |
|
String
|
summaryFullName |
|
AvatarImage
|
summaryAvatar |
avatar of the summary of the story |
String
|
summary |
user-readable summary of the story |
String
|
trackingId |
ID (visible by node admin only) that may be used to update the story viewed/read status without authentication |
String
|
remoteNodeName |
name of the node this story is about (may be absent) |
String
|
remoteFullName |
full name of the node this story is about (may be absent) |
String
|
remotePostingId |
ID of the posting at remote node this story is about (may be absent) |
String
|
remoteCommentId |
ID of the comment at remote node this story is about (may be absent) |
String -> String[]
|
operations |
list of the supported operations and the corresponding access hints |
A story was deleted.
Type | Field | Comment |
---|---|---|
String
|
id |
|
String
|
storyType |
type of the story |
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 |
ID of the posting this story is about (may be absent) |
boolean
|
viewed |
(admin only) true , if the story has been viewed by node owner, false otherwise
|
boolean
|
read |
(admin only) true , if the story has been read by node owner, false otherwise
|
String
|
summaryNodeName |
|
String
|
summaryFullName |
|
AvatarImage
|
summaryAvatar |
avatar of the summary of the story |
String
|
summary |
user-readable summary of the story |
String
|
trackingId |
ID (visible by node admin only) that may be used to update the story viewed/read status without authentication |
String
|
remoteNodeName |
name of the node this story is about (may be absent) |
String
|
remoteFullName |
full name of the node this story is about (may be absent) |
String
|
remotePostingId |
ID of the posting at remote node this story is about (may be absent) |
String
|
remoteCommentId |
ID of the comment at remote node this story is about (may be absent) |
String -> String[]
|
operations |
list of the supported operations and the corresponding access hints |
A story was updated.
Type | Field | Comment |
---|---|---|
String
|
id |
|
String
|
storyType |
type of the story |
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 |
ID of the posting this story is about (may be absent) |
boolean
|
viewed |
(admin only) true , if the story has been viewed by node owner, false otherwise
|
boolean
|
read |
(admin only) true , if the story has been read by node owner, false otherwise
|
String
|
summaryNodeName |
|
String
|
summaryFullName |
|
AvatarImage
|
summaryAvatar |
avatar of the summary of the story |
String
|
summary |
user-readable summary of the story |
String
|
trackingId |
ID (visible by node admin only) that may be used to update the story viewed/read status without authentication |
String
|
remoteNodeName |
name of the node this story is about (may be absent) |
String
|
remoteFullName |
full name of the node this story is about (may be absent) |
String
|
remotePostingId |
ID of the posting at remote node this story is about (may be absent) |
String
|
remoteCommentId |
ID of the comment at remote node this story is about (may be absent) |
String -> String[]
|
operations |
list of the supported operations and the corresponding access hints |
A node subscribed to notifications from this node.
Type | Field | Comment |
---|---|---|
String
|
id |
subscriber ID |
String
|
subscriptionType |
subscription type |
String
|
feedName |
feed name, if the subscription type requires one |
String
|
postingId |
posting ID, if the subscription type requires one |
String
|
nodeName |
name of the subscribed node |
String
|
fullName |
full name of the subscribed node |
AvatarImage
|
avatar |
avatar of the subscribed node |
timestamp
|
createdAt |
subscription creation timestamp |
A node unsubscribed from notifications from this node.
Type | Field | Comment |
---|---|---|
String
|
id |
subscriber ID |
String
|
subscriptionType |
subscription type |
String
|
feedName |
feed name, if the subscription type requires one |
String
|
postingId |
posting ID, if the subscription type requires one |
String
|
nodeName |
name of the subscribed node |
String
|
fullName |
full name of the subscribed node |
AvatarImage
|
avatar |
avatar of the subscribed node |
timestamp
|
createdAt |
subscription creation timestamp |
This node subscribed to notifications from a remote node.
Type | Field | Comment |
---|---|---|
String
|
id |
subscription ID |
String
|
subscriptionType |
subscription type |
String
|
feedName |
feed name on this node that receives notifications |
String
|
remoteSubscriberId |
ID of the subscriber on the remote node |
String
|
remoteNodeName |
name of the node this node is subscribed to |
String
|
remoteFullName |
full name of the node this node is subscribed to |
AvatarImage
|
remoteAvatar |
avatar of the node this node is subscribed to |
String
|
remoteFeedName |
feed name on the remote node, if the subscription type requires one |
String
|
remotePostingId |
posting ID on the remote node, if the subscription type requires one |
timestamp
|
createdAt |
subscription creation timestamp |
This node unsubscribed from notifications from a remote node.
Type | Field | Comment |
---|---|---|
String
|
id |
subscription ID |
String
|
subscriptionType |
subscription type |
String
|
feedName |
feed name on this node that receives notifications |
String
|
remoteSubscriberId |
ID of the subscriber on the remote node |
String
|
remoteNodeName |
name of the node this node is subscribed to |
String
|
remoteFullName |
full name of the node this node is subscribed to |
AvatarImage
|
remoteAvatar |
avatar of the node this node is subscribed to |
String
|
remoteFeedName |
feed name on the remote node, if the subscription type requires one |
String
|
remotePostingId |
posting ID on the remote node, if the subscription type requires one |
timestamp
|
createdAt |
subscription creation timestamp |