Socket Events API
Event Handlers
onlineChats
Online chats of connected user.
{
contacts: ["bowl@example.com", "bowl2@example.com"...],
groups: [
{
groupId: "12 byte unique group id1",
persons: ["bowl2@example.com", "bowl3@example.com"...]
},
{
groupId: "12 byte unique group id2",
persons: ["bowl@example.com", "bowl4@example.com"...]
}
...
]
}
contactChatMessage
Message packet that received from contact. Message has to be decrypted using private key of connected user.
{
messageType: <Any>,
message: "This received contact message is encrypted",
date: "DD/MM/YY",
time: "16:24",
from: "bowl@example.com"
}
groupChatMessage
Message packet that received from group. Message has to be decrypted using group key.
{
groupId: "12 byte unique group id.",
messageType: <Any>,
message: "This received group message is encrypted",
date: "DD/MM/YY",
time: "16:24",
from: "bowl@example.com"
}
connect_error
Socker error handling.
online
Person become online.
offline
Person become offline.
contactRequestReceived
Received contact request packet.
{
name: "Bowl",
email: "bowl@example.com",
publicKey: Base64(PublicKey(type: "spki", format: "der"))
}
groupRequestReceived
Received group request packet. Encrypted group key has to be decrypted using private key of connected user. Decrypted group key format is AES256.
{
name: "The Bowl Group",
description: "This is description of group.",
groupId: "12 byte unique group id.",
encryptedGroupKey: "This is encrypted group key that encrypted with public key of connected user"
}
newGroupMember
Received new group member packet.
{
groupId: "12 byte unique group id.",
name: "Member",
email: "bowl@example.com",
publicKey: Base64(PublicKey(type: "spki", format: "der"))
}
Event Emitters
contactChatMessage
Send encrypted chat message to contact. Message has to be encrypted using public key of contact.
groupChatMessage
Send encrypted chat message to group. Message has to be encrypted using group key.
acceptContactRequest
Accept contact request that received.
declineContactRequest
Decline contact request that received.
sendContactRequest
Send contact request to person.
acceptGroupRequest
Accept group request that received.
{
status: "OK"
members: [
{
name: "Bowl",
email: "bowl@example.com",
publicKey: Base64(PublicKey(type: "spki", format: "der")),
isAdmin: True
},
{
name: "Bowl2",
email: "bowl2@example.com",
publicKey: Base64(PublicKey(type: "spki", format: "der")),
isAdmin: false
},
{
name: "Bowl3",
email: "bowl3@example.com",
publicKey: Base64(PublicKey(type: "spki", format: "der")),
isAdmin: true
}
...
]
}
declineGroupRequest
Decline group request that received.
sendGroupRequest
Send group request to person. Group key has to be encrypted using public key of person. In order to encrypt key connected user needs to get public key of person.