Skip to content

SocketIO Events

Makhmudov Babur edited this page Jun 8, 2021 · 5 revisions

Misc: SocketIO Events

Twake uses two types of events, that are broadcasted to subscribers:

  • Events
  • Resources

List of possible events:

  • Channel/Direct message
  • Thread message

List of possible resources:

  • Channel activity
  • Channel
  • Channel member

Also each event/resource can have different actions. Examples:

Thread message was created:

{
    name: previous::channels/2982dc0a-65aa-47ae-a13c-082b2e3cc2a9/messages/updates, 
    data: {
        client_id: system, 
        action: update, 
        message_id: 5828c718-b49e-11eb-8ae0-0242ac120003, 
        thread_id: c920712e-b49d-11eb-8ed2-0242ac120003
    }
}

Channel message was created:

{
    name: previous::channels/2982dc0a-65aa-47ae-a13c-082b2e3cc2a9/messages/updates, 
    data: {
        client_id: system, 
        action: update, 
        message_id: c51b32c0-b49e-11eb-ad1a-0242ac120003, 
        thread_id: 
    }
}

Channel message was edited:

{
    name: previous::channels/2982dc0a-65aa-47ae-a13c-082b2e3cc2a9/messages/updates, 
    data: {
        client_id: system, 
        action: update, 
        message_id: c920712e-b49d-11eb-8ed2-0242ac120003, 
        thread_id: 
    }
}

Channel message was removed:

{
    name: previous::channels/2982dc0a-65aa-47ae-a13c-082b2e3cc2a9/messages/updates, 
    data: {
        client_id: system, 
        action: remove, 
        message_id: c51b32c0-b49e-11eb-ad1a-0242ac120003, 
        thread_id: 
    }
}

Channel had some activity:

{
    action: updated, 
    room: /companies/ac1a0544-1dcc-11eb-bf9f-0242ac120004/workspaces/ae6e73e8-504e-11eb-9a9c-0242ac120004/channels?type=public, 
    type: channel_activity, 
    path: /companies/ac1a0544-1dcc-11eb-bf9f-0242ac120004/workspaces/ae6e73e8-504e-11eb-9a9c-0242ac120004/channels/2982dc0a-65aa-47ae-a13c-082b2e3cc2a9, 
    resource: {
        company_id: ac1a0544-1dcc-11eb-bf9f-0242ac120004, 
        workspace_id: ae6e73e8-504e-11eb-9a9c-0242ac120004, 
        id: 2982dc0a-65aa-47ae-a13c-082b2e3cc2a9, 
        last_activity: 1620987774000, 
        last_message: {
            date: 1620987774000, 
            sender: 46a68a02-1dcc-11eb-95bd-0242ac120004, 
            sender_name: First Last, 
            title: 📄 ch1 in TestCompany • WS1, text: Message 2
        }
    }
}

Channel was created in workspace:

{
    action: saved, 
    room: /companies/ac1a0544-1dcc-11eb-bf9f-0242ac120004/workspaces/ae6e73e8-504e-11eb-9a9c-0242ac120004/channels?type=public, 
    type: channel, 
    path: /companies/ac1a0544-1dcc-11eb-bf9f-0242ac120004/workspaces/ae6e73e8-504e-11eb-9a9c-0242ac120004/channels/2982dc0a-65aa-47ae-a13c-082b2e3cc2a9, 
    resource: {
        is_default: false, 
        archived: false, 
        members: [], 
        connectors: [], 
        last_activity: 1620987956000, 
        company_id: ac1a0544-1dcc-11eb-bf9f-0242ac120004, 
        workspace_id: ae6e73e8-504e-11eb-9a9c-0242ac120004, 
        id: 2982dc0a-65aa-47ae-a13c-082b2e3cc2a9, 
        archivation_date: 0, 
        channel_group: , 
        description: , 
        icon: 📄, 
        name: Primary channel, 
        owner: 46a68a02-1dcc-11eb-95bd-0242ac120004, 
        visibility: public
    }
}

Channel memeber was added:

{
    action: saved, 
    room: /companies/ac1a0544-1dcc-11eb-bf9f-0242ac120004/workspaces/ae6e73e8-504e-11eb-9a9c-0242ac120004/channels?type=private&user=5268fa80-19d2-11eb-b774-0242ac120004
    type: channel_member, 
    path: /, 
    resource: {
        company_id: ac1a0544-1dcc-11eb-bf9f-0242ac120004, 
        workspace_id: ae6e73e8-504e-11eb-9a9c-0242ac120004, 
        id: 5ffc2707-c7f0-4cea-b439-9a7a8a23bdc8, 
        user_member: {
            type: member, 
            favorite: false, 
            notification_level: mentions, 
            user_id: 5268fa80-19d2-11eb-b774-0242ac120004, 
            channel_id: 5ffc2707-c7f0-4cea-b439-9a7a8a23bdc8, 
            _primaryKey: 5ffc2707-c7f0-4cea-b439-9a7a8a23bdc8+5268fa80-19d2-11eb-b774-0242ac120004, 
            company_id: ac1a0544-1dcc-11eb-bf9f-0242ac120004, 
            workspace_id: ae6e73e8-504e-11eb-9a9c-0242ac120004
        }
    }
}

Member was removed from channel:

{
    action: deleted, 
    room: /companies/ac1a0544-1dcc-11eb-bf9f-0242ac120004/workspaces/ae6e73e8-504e-11eb-9a9c-0242ac120004/channels?type=private&user=5268fa80-19d2-11eb-b774-0242ac120004, 
    type: channel_member, 
    path: /, 
    resource: {
        company_id: ac1a0544-1dcc-11eb-bf9f-0242ac120004, 
        workspace_id: ae6e73e8-504e-11eb-9a9c-0242ac120004, 
        id: 5ffc2707-c7f0-4cea-b439-9a7a8a23bdc8, 
        user_member: null
    }
}

Channel was deleted:

{
    action: deleted, 
    room: /companies/ac1a0544-1dcc-11eb-bf9f-0242ac120004/workspaces/ae6e73e8-504e-11eb-9a9c-0242ac120004/channels?type=public, 
    type: channel, 
    path: /companies/ac1a0544-1dcc-11eb-bf9f-0242ac120004/workspaces/ae6e73e8-504e-11eb-9a9c-0242ac120004/channels/5ffc2707-c7f0-4cea-b439-9a7a8a23bdc8, 
    resource: {
        is_default: false, 
        archived: false, 
        members: [], 
        connectors: [], 
        last_activity: 0, 
        id: 5ffc2707-c7f0-4cea-b439-9a7a8a23bdc8, 
        company_id: ac1a0544-1dcc-11eb-bf9f-0242ac120004, 
        workspace_id: ae6e73e8-504e-11eb-9a9c-0242ac120004
    }
}
Clone this wiki locally