Console events
Every event the console sends, what it carries, how to listen to some of them and how to catch up after a gap.
For: developers · From BeeBEEP 6.0.0 · Updated on
An event is a line BeeBEEP sends to a console connection, with no command asking for it: a user came online, a message arrived, a file moved on. This page is for whoever writes a bot or an integration, and gives the events with what each one carries. How to start the console and connect is on the console, and the commands are on the commands page.
How events arrive
An event is one line of JSON with the key event, and its fields under data:
{"event":"unreadCountChanged","data":{"chatId":1001,"unreadCount":1,"unreadMentions":0}}
Every connection is subscribed from the start: no command is needed to hear them. A line is an event when it has the key event, a reply when it has ok and the banner when it has banner; none has another's key.
Every event has a scope, the one a connection needs to hear it, and the events below are all heard at read and above. A connection that has not authenticated, at none, hears no event.
An event can arrive before the reply to the command that caused it, or right after it. send_message is followed by its own chatMessageAdded, and create_group by groupUpdated. A program that takes "the next line" for the reply to what it just sent sometimes reads an event instead: look for the key ok to find a reply, as the example does.
The one event a connection cannot avoid is consoleClosing, the farewell: it reaches every authenticated connection, whatever it subscribed to, as the last line before the end of the stream.
Subscribe to some events
subscribe with a list of names keeps only those events:
{"cmd":"subscribe","events":["chatMessageAdded","userConnected"]}
A plain subscribe, with no events, goes back to every event. A name that is unknown, or above the connection's scope, is refused by name with the code unknownEvent, and the filter stays as it was, so that a typo cannot filter everything out. An empty list is refused with invalidValue. A name given twice counts once. The filter survives a second auth.
unsubscribe stops the events of the connection and drops its filter; commands go on working. set with param notifications and value off is the same as unsubscribe, and on the same as subscribe.
A connection that does not read its events fast enough is closed (see the limits): a program that needs only a few events does well to subscribe to those.
What an event carries
An event's data holds only what happened. Its fields follow the rules of the commands: ids are whole numbers (userId, groupId, chatId), a uuid is text without braces, a time is milliseconds since 1970, and a field that has no value is a JSON null. Some events carry only an id, to say "go and look": userUpdated and groupUpdated do not say what changed, and the program reads the user with get_user or the group with get_group. chatMessageAdded carries a whole chat message object, the one described on the commands page, without its recipients; what happens to a message afterwards comes as what changed, with the names a person reads beside every id.
Catch up after a gap
No event is ever replayed. A connection that was unsubscribed, was closed because it read too slowly, or was not connected, has no way to learn what it missed. An event is a hint to look, never the record of what happened: when a program must be sure of the current state, it asks.
| What you need | Ask with |
|---|---|
| the users and who is online | list_users, or get_user for one |
| the groups and their members | list_groups, or get_group for one |
| the messages of a chat | get_chat_history, going back with oldestMessageId |
| what is unread | get_unread_counts |
| the files in transit | list_file_transfers, or get_file_transfer for one |
| your own state | status |
The events
Each table gives an event's name, the fields of its data, and what happened. help lists the names of the events a connection can hear, with the scope of each.
Users and connections
| Event | Data | What happened |
|---|---|---|
userConnected | userId | A user came online. |
userDisconnected | userId | A user went offline. |
userNotResponding | userId | Every connection to that user has stopped answering, though each is still open. The user stays online; this says so sooner than the timeout that closes a dead connection would. |
userRespondingAgain | userId | That user answered again after userNotResponding. |
identityInUse | transport (network or bluetooth), address | Another installation presents your profile with a different security key: BeeBEEP open on two devices at once, or someone else using your profile. address is the other device's, empty over Bluetooth. Said once per key in a session. |
userUpdated | userId | Something about that user changed. Read it again with get_user; the event does not carry the new value. |
userRemoved | userId | BeeBEEP erased that user, who had no messages, no group and was neither a contact nor blocked. Nothing is left to read with get_user. |
inactiveUsersRemoved | hidden, erased, hiddenIds, erasedIds, days | Once per cleanup of the users not seen for days days of use, when it did something: hidden users, kept for their messages, left out of list_users until they come back (userUpdated for each), and erased users who left nothing (userRemoved for each). A cleanup that found nobody sends nothing. |
leaseExpired | uuid, userId | Nothing has been heard from that installation lately and no connection to it is open. userId is null when no user is known under that uuid. It never changes a user's status: a connection still means online. |
nearbyHeard | uuid, userId, source | A contact was recognised nearby over Bluetooth, one hop away, by what their device puts on the air (source is Nearby). Sent when they become nearby, not each time they are heard again. A hint, never a proof: it does not make the user online. |
nearbyLost | uuid, userId, source | That contact is no longer heard nearby over Bluetooth, or was blocked. leaseExpired follows when nothing else is left of them. |
meshHeard | uuid, userId, source | A contact's presence came over the Bluetooth mesh, through phones in between (source is Mesh). Sent when it starts, not each time it is heard again. A hint, never a proof: it does not make the user online, but their private texts can go over the mesh. |
meshLost | uuid, userId, source | That contact's presence over the Bluetooth mesh ran out, or they were blocked or removed. userId is null when no user is left under that uuid. leaseExpired follows when nothing else is left of them. |
meshDelivered | messageUuid, userId | A private text sent over the Bluetooth mesh was acknowledged by its recipient over the mesh: its receipt is now delivered (chatMessageReceiptChanged says so too). |
lanFromBluetooth | userId, address, port, outcome, reason | What became of one network address a contact sent over Bluetooth, so that the two can talk over the local network instead. outcome is dialed (BeeBEEP is trying it), linked (a network connection came up after that try), unreachable (the try ended without a connection, for example on a network that keeps its devices apart; the address is not tried again for a while) or skipped (not tried). reason says why when skipped: alreadyLinked, otherNetwork, pending or unreachable; otherwise it is empty. Skipped addresses are reported only when they have just arrived, never at a later retry. |
byeReceived | uuid, userId | That installation announced that it is going away, with a signed goodbye BeeBEEP accepted. userId is null when no user is known under that uuid. |
connectionProblems | interface | BeeBEEP hears nobody on that network interface (for example eth0) although a user went silent there, which points to this computer's side. While it lasts no user there is reported as not responding and nothing is closed. |
connectionProblemsCleared | interface | Over: something was heard on that interface again, or the interface went away. |
peerCheckSent | userId, groupId, recipients | BeeBEEP is sure that a user stopped answering while its own connections work, and asked recipients other members of that group to check on them. One event for each group. |
peerCheckReceived | fromUserId, userId, groupId, acted, reason | A member asked BeeBEEP to check on userId. acted is true when BeeBEEP schedules its own check, false when it ignores the hint, and reason then says why (reason is absent when acted is true). groupId is 0 for a group this installation does not know. A hint never changes anybody's status. |
defaultChatSendingChanged | allowed, onlineUsersPeak, reason | Sending to BEEP, the room of whoever is online now, was refused (allowed false: too many people are online in it) or is allowed again. reason is the sentence to show while it is refused, empty when allowed. One event for each change; the room stays readable. |
Chats and messages
| Event | Data | What happened |
|---|---|---|
chatMessageAdded | message | A new message in a chat, sent or received. message is the chat message object of the commands page, without its recipients. A message held in memory for lack of disk space comes twice: first with isTemporary true, then once it is saved. What happens to a message afterwards has events of its own. |
chatMessageReceiptChanged | chatId, chatName, chatKind, messageUuid, recipientId, recipientName, state, timestamp, reason, overallState, recipientCount, deliveredCount, readCount | Someone received (state Delivered) or read (Read) one of your messages, or a copy of it was given up (Failed). reason comes with Failed only: notDeliveredInTime (BEEP's copies wait 30 seconds), waitedTooLong (a copy waited past its term of active days) or recipientHidden (the recipient was hidden for inactivity). overallState and the counts say where the whole message stands, so the last event alone tells whether everyone has read it. A copy only written to the network (Sent) sends nothing. |
chatMessagesMarkedRead | chatId, chatName, chatKind, messageUuids, count | You read these received messages, in the app or with mark_read: one event for each marking, never one for each message. Someone else reading your message is chatMessageReceiptChanged. |
waitingMessagesChanged | chatId, messageCount | The messages of yours still waiting to be sent in this chat changed: one more, one fewer, or someone else they wait for. get_waiting_messages says for whom and why. |
chatMessageRecipientsWithdrawn | chatId, chatName, chatKind, messageUuid, recipientIds, recipientNames, reason | Copies of one of your messages were withdrawn: they are not sent and no longer count among its recipients. reason is outOfSight (members your circles no longer see), invitationExpired (a plugin's invitation that expired before it could leave) or deletedBySender (you deleted the message, for yourself or for everyone, before these copies left). |
chatMessageReactionChanged | chatId, chatName, chatKind, messageUuid, reactorId, reactorName, emoji, isRemoval, timestamp | A reaction on a message was set, replaced or removed, by this installation (reactorId 1) or by another user. emoji is the new one, empty with isRemoval true; timestamp is the reaction's own. Once per change: your own reaction reaching its recipients one by one sends nothing more. |
chatMessageEdited | chatId, chatName, chatKind, messageUuid, text, mentionsMe, editedAt, changeShownAt | A message's sender changed its text, here (one of your messages, edit_message) or on another installation. text is the new text; editedAt the edit's stamp on the sender's clock (what orders two edits), 0 for one of yours edited before any copy was delivered (no "edited" mark); changeShownAt when it happened on this installation's clock, never before the message -- the time to show. Never a new message and never a notification. |
chatMessageDeleted | chatId, chatName, chatKind, messageUuid, senderId, senderName, deletedAt, changeShownAt | A message's sender deleted it for everyone: the copy here is now the placeholder, its words gone. deletedAt is the sender's stamp, changeShownAt when it happened on this installation's clock (the time to show). A deleted message is never unread. |
chatMessageChangeRefused | messageUuid, change, reason | An edit_message or a delete_message for everyone was refused (change edit or delete). reason: notFound, notOwn, notChangeable (an attachment, a forward, an invitation...), alreadyDeleted, turnedOff (the window is 0), tooLate, emptyText, tooLong or unchanged. |
chatPollVoteChanged | chatId, chatName, messageUuid, voterId, voterName, answers, isTakenBack, timestamp | A vote on a poll changed here: yours (vote_poll, voterId 1) or someone else's, cast, changed or taken back (answers empty, isTakenBack true). answers are the indexes chosen, from 0. Never a new message and never a notification. |
chatPollClosed | chatId, chatName, messageUuid, closedAt, votes | A poll was closed, by you (close_poll) or by whoever asked it: votes is the final count, each entry voterId, voterName and answers; nobody can vote on it any more. |
chatPollActRefused | messageUuid, act, reason | A vote_poll or a close_poll was refused (act vote or close). reason: notFound, notPoll, closed, notMember, badAnswer or notAuthor. |
chatMessageChangeMissedLegacyPeers | chatId, chatName, messageUuid, change, peerIds, peerNames | One of your messages was edited or deleted for everyone, and these recipients use BeeBEEP 5.x: on their side the message stays as it was. |
chatCleared | chatId | The chat was emptied here (clear_chat, or Delete conversation on the chat's information): its messages are gone from this installation, its preview is empty, its unread count 0. The others keep theirs. |
connectionTestStep | testId, step, verdict, code, details | One step of the running connection test (test_connection) has a verdict now, or a new one: one event per step that changed, a step still pending never said. |
connectionTestFinished | as connection_test_status | The connection test is over: running is false, and its cause and every step are final. |
unreadCountChanged | chatId, unreadCount, unreadMentions | The number of unread messages of a chat changed. unreadMentions is how many of them mention you: your name, an @all, or a reply to one of your messages, in a group. |
typingStateChanged | chatId, senderId, isTyping, activity | senderId started or stopped typing in a chat, or switched between typing and recording a voice note. activity is Typing, RecordingVoice or Idle; isTyping is false for Idle. A refresh of the same activity sends nothing, and an activity that is not refreshed ends by itself. |
notificationRaised | notification | BeeBEEP raised a notification of its own. notification holds type (always System), text, sourceId and timestamp. |
chatSystemLine | chatId, text | A line BeeBEEP itself wrote in a chat, such as a notice that a message was not delivered. It is never a message: it is not in get_chat_history and has no chatMessageAdded. |
chatArchivesImported | sourceFilePath, programVersion, error, chatsRead, added, alreadyHere, declined, linked, mediaCopied, mediaMissing | The saved chats of a BeeBEEP 5.x installation, read by import_legacy_installation, are stored as archives, after the import's own answer. error says why nothing was read; alreadyHere counts the chats an earlier import stored, declined those not stored because the disk is almost full (a later import tries them again), linked those shown in a chat here. list_archives already lists them. |
presetMessagesChanged | presetMessages | Your preset messages changed: one was added, changed, removed or moved, the list was sorted, or it was read at the start. presetMessages is the whole list, as list_preset_messages gives it. |
Files
| Event | Data | What happened |
|---|---|---|
fileTransferOfferReceived | messageUuid, senderId, fileName, fileSize, contentHash, mimeType | A user offered a file and a decision may be needed: answer with accept_file_transfer or reject_file_transfer, naming messageUuid. |
fileTransferSameFileAsked | actionId, chatId, chatName, fileNames | The same file is still on its way in this chat. Nothing more is sent until answer_same_file_question says which one to cancel. |
fileTransferWarning | chatId, text | A passing remark about a transfer of that chat, for example not to move or delete the file until it is sent. Not stored. |
fileTransferError | messageUuid, chatId, reason | An offer made with send_file failed later, after the command answered, for example while the file was being read. |
fileTransferProgress | messageUuid, peerUuid, direction, bytesTransferred, totalBytes | How far a transfer has come. At most one event for each transfer every 100 milliseconds, always the latest count, and the last one comes before the transfer's Completed. |
fileTransferStateChanged | messageUuid, peerUuid, direction, state | A transfer moved to a new state: Offered, Accepted, Requesting, Transferring, Paused, Completed, Rejected, Failed or Canceled. |
fileTransferRejected | messageUuid, peerUuid, reason | A user declined a file this installation offered, and reason says why: UserDeclined, LocalPolicyBlocked, LocalError, AlreadyReceived, AlreadyDownloading, AwaitingDecision, FileTypeNotAllowed or LegacyPolicy (a 5.x recipient's settings, which do not say which one). It comes with the Rejected state change, and never for a decision of our own. |
fileTransferUnavailable | messageUuid, peerUuid | The sender of a file or voice note this installation was downloading can no longer send it: the file is gone or changed, or the message was deleted. It comes with the Failed state change; retry_file_transfer refuses that download from then on. |
fileTransferRecordRemoved | messageUuid, peerUuid, direction | A transfer was canceled, on either side, and left the live lists. Its record stays with the state Canceled, and get_file_transfer still returns it. |
Groups
| Event | Data | What happened |
|---|---|---|
groupUpdated | groupId | Something about that group changed. Read it again with get_group; the event does not carry the new value. |
groupInvitationReceived | chatId, messageUuid, inviterId, groupUuid, groupName, memberCount, invitationId, expiresAt, text | Someone invited you to a group. Answer with answer_group_invitation, passing these fields back. expiresAt is 0 when the invitation does not expire. |
groupInvitationAnswered | chatId, messageUuid, fromUserId, groupUuid, groupId, invitationId, answer, outcome | An answer to an invitation arrived and was acted on. answer is accept, decline or noLongerValid; outcome is joined, alreadyMember, declined, noLongerValid or refused. groupId is 0 when the group is not held here. |
groupJoined | groupId, groupUuid, name | This installation joined a group, or was added to it again, because of an invitation it accepted. |
groupRulesApplied | groupId, invitedIds, removedIds | A group's own rules, kept by this installation as one of its admins, invited some users (a BeeBEEP 5.x user is added) or removed members not seen for the rule's days. Sent only when the rules did something. |
Plugins
| Event | Data | What happened |
|---|---|---|
pluginInviteReceived | chatId, messageUuid, inviterId, sessionId, pluginId, pluginVersion, pluginName, modeId, modeName, storeUrl, seats, expiresAt, autoAnswer | Someone invited you to a plugin session. autoAnswer is busy or unavailable when BeeBEEP answered by itself and empty when the user is asked; answer with answer_plugin_invite. |
pluginInviteAnswered | sessionId, userId, userUuid, state | An invitation you sent changed state: accepted, declined, busy, unavailable, expired or replaced. userId is null when the user is not known. |
pluginSessionStarted | the fields of a session record | A plugin session runs here: it started, was adopted when its inviter started it, or was resumed. The fields are those of one entry of list_plugin_sessions. |
pluginSessionSuspended | sessionId | A session was put aside on this side. |
catalogueRead | outcome | A read of the catalogue of Mini Apps ended: accepted, unreachable, untrusted or off. |
catalogueInstalled | id, status, version, message | install_from_catalogue ended for the entry id. |
pluginDataReceived | sessionId, fromId, fromUuid, sequence, byteCount, text, bytesBase64, bytesOmitted | A plugin session received bytes. Up to 4 KiB they come with the event: bytesBase64 always, text too when they are valid UTF-8. Larger ones, such as a shared screen's frames, come as byteCount alone, with bytesOmitted true. fromId is null when the sender is not known. |
pluginDataWaiting | sessionId, fromUuid | Data arrived for a session known here but not running, one that waits for its start or is suspended. The sender keeps it. |
pluginDeliveryFailed | sessionId, sequence | A send with a deadline reached it without an acknowledgement. |
pluginParticipantChanged | sessionId, userId, userUuid, online | A participant of an active session came online or went away. userId is null when the user is not known. |
pluginSessionEnded | sessionId, reason | A session ended, here, by the other side, or because an invitation came to nothing. reason is ended, declined, busy, unavailable, expired, error or none. |
liveChannelPathChanged | sessionId, userUuid, path | The way a live session's frames reach a participant changed. path is none, probing, udp or tcp. |
Networks
| Event | Data | What happened |
|---|---|---|
dialGaveUp | address | A connection asked for by hand, with connect_to_address or in the app, failed through all its retries and is no longer retried by itself. connect_to_address dials it again at once. |
hostNotFound | host | A host name asked for by hand resolved to no address worth dialing, so nothing was dialed. |
dialRefused | address | A connection asked for by hand was not made, because the administrator keeps BeeBEEP to a list of computers and that address is not on it. address is ip:port. |
unclassifiedNetworkJoined | networkId, name | A network nobody has classified yet was joined: the moment to ask the user and call set_network_category. |
networkCategoryChanged | networkId, previousCategory, category | A network's category changed, through set_network_category or, on Windows, by the operating system. |
networkPromotionsRevocable | networkId, userCount | A network stopped being private while userCount users it made contacts are still contacts. Nobody was demoted; revert_network_promotions does it. |
searchCompleted | none | The search started by search_users ended, and any Bluetooth or multicast search it started has stopped. |
firewallVerdictChanged | firewall | The firewall's verdict on this program's incoming connections changed. firewall is the word status reports: open, allowed, blocked, promptComes, thirdParty, policy or empty when nothing is read. |
The program and the computer
| Event | Data | What happened |
|---|---|---|
circlesChanged | circles, circlesLocked | Your circles changed, through set_circles, the app or the administrator's policy file. The fields are those of get_circles. |
clockStateChanged | looksWrong, violatedFloor, systemClock, floorValue | The verdict on the computer's clock changed, which is rare: at start when there is something to say, after a jump of the clock, after set_clock_time or confirm_system_clock. The fields are those of clock_status. |
dataFolderUnwritable | folder | The data folder checked at start cannot be written, so nothing can be saved while it lasts. |
dataFolderWritableAgain | folder | A later start found the data folder writable again. |
settingsFileUnwritable | file | The settings file is read-only in a folder that can be written: a changed setting lasts only until BeeBEEP ends. |
settingsFileWritableAgain | file | The settings file can be written again. |
lowDiskSpace | none | The disk is too full: the database keeps what it should write in memory. |
diskSpaceRecovered | none | Writes go to disk again and what was held in memory is saved. |
guiStall | durationMs, endedAtMs | BeeBEEP's window answers again after it stopped answering for longer than guiStallWarnMsecs: durationMs is how long, endedAtMs when it ended, in milliseconds since 1970. Messages and the console went on meanwhile. |
sessionActivityChanged | active, reason | On a Linux desktop only: the session was locked, put under a screen saver or behind another session (active false: BeeBEEP stops drawing its windows, messages go on), or is back (active true). reason names what decided: sessionInactive, locked, lockRequested or screenSaver on the way away; sessionActive, unlocked, unlockRequested, screenSaverOff or lockUnconfirmed on the way back. |
newerVersionAvailable | version, page | A newer BeeBEEP is out: version is its number, page where to get it. Said once per version in a run. |
The console itself
| Event | Data | What happened |
|---|---|---|
consoleClosing | reason, code | The farewell, the last line before the console closes the connection. code is switchedOff (the person switched the console off in Settings) or quitting (BeeBEEP is shutting down); reason is its English text. It reaches every authenticated connection, whatever it subscribed to. |