Events

Table of Contents

In Gentics Mesh events can be used to exchange information in between clients and to inform clients about changes in the CMS.

Typical use cases for event handling:

  • Exchange data in between client applications (e.g. Chat)

  • Real time reload if data via mesh.node.updated changes.

  • Client-Side cache purging if data is updated, created, deleted.

  • Hooking external hardware sensors into your front-end.

Intro

Events in Gentics Mesh can be triggered by various action. Updating a user for example will trigger the mesh.user.updated event. Events for specific actions can be received by registering on the event address (e.g. mesh.user.updated or mesh.user.deleted).

A websocket endpoint is used to deliver event messages to clients which register on the event addresses.

Typical workflow:

  • Authenticate HTTP client

  • Connect client to websocket

  • Send message on websocket to register on specific event addresses

  • Receive events messages

  • Regularly send ping messages.

Eventbus Bridge & Websocket

The /api/v2/eventbus endpoint allows clients to access the eventbus. This is useful if you want to react on specific events.

The endpoint is SockJS compliant. It is also possible to access the websocket directly via: /api/v2/eventbus/websocket.

Javascript projects can use the vertx3-eventbus-client library to connect to the eventbus bridge.

Message Types

Registering

Once the websocket has been opened you can send a text frame to Gentics Mesh that contains the information to which address you want to register to. Once registered the client will receive the published messaged on that address.

{
  "type": "register",
  "address": "mesh.user.updated"
}

Unregistering

If you want to unregister for specific events you can send a message of type unregister.

{
  "type": "unregister",
  "address": "mesh.user.updated"
}

Publishing

You can publish a message which will be received by all recipients which has registered on to the used address. The published message will be delivered to each of the recipients.

{
  "type": "publish",
  "address": "custom.event",
  "body": "someText"
}

Sending

Sending a message is different from publishing. When sending a message it will only be received by one randomly selected recipient.

{
  "type": "publish",
  "address": "custom.event",
  "body": "someText"
}

Ping

The eventbus bridge requires the client to send a regular ping message. The timeout for a ping message is currently set to 10 seconds. The websocket will automatically be terminated if no ping message has been received in this interval.

Handling the ping message is essential. The eventbus bridge will not work properly without handling ping messages.
{
  "type": "ping"
}

Addresses

The following list contains all event addresses with examples which Gentics Mesh exposes.

mesh.project.version_purge.start

Emitted once a version purge job starts

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "demo",
  "status" : "RUNNING"
}

mesh.project.version_purge.finished

Emitted once a version purge job finishes successully or failed

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "demo",
  "status" : "RUNNING"
}

mesh.schema.migration.start

Emitted once a schema migration starts.

Example
{
  "branch" : {
    "name" : "demoV1",
    "uuid" : "b12272150db4490ea272150db4190e72"
  },
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "status" : "RUNNING",
  "fromVersion" : {
    "name" : "folder",
    "uuid" : "cd6b4f2851814773ab4f28518137735f",
    "version" : "1",
    "versionUuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  },
  "toVersion" : {
    "name" : "folder",
    "uuid" : "cd6b4f2851814773ab4f28518137735f",
    "version" : "2",
    "versionUuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  }
}

mesh.schema.migration.finished

Emitted once the migration finishes successful or failed.

Example
{
  "branch" : {
    "name" : "demoV1",
    "uuid" : "b12272150db4490ea272150db4190e72"
  },
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "status" : "RUNNING",
  "fromVersion" : {
    "name" : "folder",
    "uuid" : "cd6b4f2851814773ab4f28518137735f",
    "version" : "1",
    "versionUuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  },
  "toVersion" : {
    "name" : "folder",
    "uuid" : "cd6b4f2851814773ab4f28518137735f",
    "version" : "2",
    "versionUuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  }
}

mesh.schema-branch.assign

Emitted once a schema has been assigned to a branch.

Example
{
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "branch" : {
    "name" : "demoV1",
    "uuid" : "b12272150db4490ea272150db4190e72"
  },
  "schema" : {
    "name" : "folder",
    "uuid" : "cd6b4f2851814773ab4f28518137735f",
    "version" : "1",
    "versionUuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  },
  "status" : "COMPLETED"
}

mesh.schema-branch.unassign

Emitted once a schema has been unassigned from a branch.

Example
{
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "branch" : {
    "name" : "demoV1",
    "uuid" : "b12272150db4490ea272150db4190e72"
  },
  "schema" : {
    "name" : "folder",
    "uuid" : "cd6b4f2851814773ab4f28518137735f",
    "version" : "1",
    "versionUuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  },
  "status" : "COMPLETED"
}

mesh.microschema-branch.assign

Emitted once a microschema gets assigned to a branch.

Example
{
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "branch" : {
    "name" : "demoV1",
    "uuid" : "b12272150db4490ea272150db4190e72"
  },
  "schema" : {
    "name" : "vcard",
    "uuid" : "cd6b4f2851814773ab4f28518137735f",
    "version" : "1",
    "versionUuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  },
  "status" : "COMPLETED"
}

mesh.microschema-branch.unassign

Emitted once a microschema gets unassigned from a branch.

Example
{
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "branch" : {
    "name" : "demoV1",
    "uuid" : "b12272150db4490ea272150db4190e72"
  },
  "schema" : {
    "name" : "vcard",
    "uuid" : "cd6b4f2851814773ab4f28518137735f",
    "version" : "1",
    "versionUuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  },
  "status" : "COMPLETED"
}

mesh.microschema.migration.start

Emitted when a microschema migration starts.

Example
{
  "branch" : {
    "name" : "demoV1",
    "uuid" : "b12272150db4490ea272150db4190e72"
  },
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "status" : "RUNNING",
  "fromVersion" : {
    "name" : "vcard",
    "uuid" : "cd6b4f2851814773ab4f28518137735f",
    "version" : "1",
    "versionUuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  },
  "toVersion" : {
    "name" : "vcard",
    "uuid" : "cd6b4f2851814773ab4f28518137735f",
    "version" : "2",
    "versionUuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  }
}

mesh.microschema.migration.finished

Emitted when a microschema migration finishes.

Example
{
  "branch" : {
    "name" : "demoV1",
    "uuid" : "b12272150db4490ea272150db4190e72"
  },
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "status" : "RUNNING",
  "fromVersion" : {
    "name" : "vcard",
    "uuid" : "cd6b4f2851814773ab4f28518137735f",
    "version" : "1",
    "versionUuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  },
  "toVersion" : {
    "name" : "vcard",
    "uuid" : "cd6b4f2851814773ab4f28518137735f",
    "version" : "2",
    "versionUuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  }
}

mesh.branch.migration.start

Emitted when a branch migration job starts.

Example
{
  "branch" : {
    "name" : "demoV1",
    "uuid" : "b12272150db4490ea272150db4190e72"
  },
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "status" : "RUNNING"
}

mesh.branch.migration.finished

Emitted when a branch migration job finishes.

Example
{
  "branch" : {
    "name" : "demoV1",
    "uuid" : "b12272150db4490ea272150db4190e72"
  },
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "status" : "RUNNING"
}

mesh.startup-complete

Emitted once the Gentics Mesh instance is fully started and ready to accept requests.

job.worker

Event which will trigger job processing.

mesh.cluster.node.joining

Emitted when a node joins the cluster.

mesh.cluster.node.joined

Emitted when a node joined the cluster.

mesh.cluster.node.leaving

Emitted when a node is leaving the cluster.

mesh.cluster.node.left

Emitted when a cluster node left the cluster.

mesh.cluster.db.status

Emitted when the database status changes. (e.g. offline, online, backup, syncing)

mesh.clear-permission-store

Event which will clear the permission stores.

mesh.user.created

Emitted when a user was created.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "joedoe"
}

mesh.user.updated

Emitted when a user was updated.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "joedoe"
}

mesh.user.deleted

Emitted when a user was deleted.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "joedoe"
}

mesh.group.created

Emitted when a group was created.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "guests"
}

mesh.group.updated

Emitted when a group was updated.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "guests"
}

mesh.group.deleted

Emitted when a group was deleted.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "guests"
}

mesh.group-user.assigned

Emitted when a user was assigned to a group.

Example
{
  "group" : {
    "name" : "guests",
    "uuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  },
  "user" : {
    "firstName" : "Joe",
    "lastName" : "Doe",
    "uuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  }
}

mesh.group-user.unassigned

Emitted when a user was unassigned from a group.

Example
{
  "group" : {
    "name" : "guests",
    "uuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  },
  "user" : {
    "firstName" : "Joe",
    "lastName" : "Doe",
    "uuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  }
}

mesh.group-role.assigned

Emitted when a role was assigned to a group.

Example
{
  "group" : {
    "name" : "guests",
    "uuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  },
  "role" : {
    "name" : "translator",
    "uuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  }
}

mesh.group-role.unassigned

Emitted when a role was unassigned from a group.

Example
{
  "group" : {
    "name" : "guests",
    "uuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  },
  "role" : {
    "name" : "translator",
    "uuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  }
}

mesh.role.created

Emitted when a role was created.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "translator"
}

mesh.role.updated

Emitted when a role was updated.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "translator"
}

mesh.role.deleted

Emitted when a role was deleted.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "translator"
}

mesh.role.permissions.changed

Emitted when the role permissions were changed.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "editors",
  "type" : "GROUP",
  "role" : {
    "name" : "translator",
    "uuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  }
}

mesh.tag.created

Emitted when a tag was created.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "red",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "tagFamily" : {
    "name" : "colors",
    "uuid" : "cd6b4f2851814773ab4f28518137735f"
  }
}

mesh.tag.updated

Emitted when a tag was updated.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "red",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "tagFamily" : {
    "name" : "colors",
    "uuid" : "cd6b4f2851814773ab4f28518137735f"
  }
}

mesh.tag.deleted

Emitted when a tag was deleted.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "red",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "tagFamily" : {
    "name" : "colors",
    "uuid" : "cd6b4f2851814773ab4f28518137735f"
  }
}

mesh.tagfamily.created

Emitted when a tag family was created.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "colors",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  }
}

mesh.tagfamily.updated

Emitted when a tag family was updated.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "colors",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  }
}

mesh.tagfamily.deleted

Emitted when a tag family was deleted.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "colors",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  }
}

mesh.project.created

Emitted when a project was created.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "demo"
}

mesh.project.updated

Emitted when a project was updated.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "demo"
}

mesh.project.deleted

Emitted when a project was deleted.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "demo"
}

mesh.project-schema.assigned

Emitted when a schema was assigned to a project.

mesh.project-schema.unassigned

Emitted when a schema was unassigned from a project.

mesh.project-microschema.assigned

Emitted when a microschema was assigned to a projec.t

mesh.project-microschema.unassigned

Emitted when a microschema was unassigned from a project.

mesh.project-latest-branch.updated

Emitted when the latest branch reference of a project was updated.

mesh.node.created

Emitted when a node was created.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "branchUuid" : "cd6b4f2851814773ab4f28518137735f"
}

mesh.node.updated

Emitted when a node was updated.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "branchUuid" : "cd6b4f2851814773ab4f28518137735f"
}

mesh.node.deleted

Emitted when a node was deleted.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "branchUuid" : "cd6b4f2851814773ab4f28518137735f"
}

mesh.node.tagged

Emitted when a node was tagged.

Example
{
  "tag" : {
    "name" : "red",
    "uuid" : "e5861ba26b914b21861ba26b91ab211a",
    "tagFamily" : "colors"
  },
  "branch" : {
    "name" : "demoV1",
    "uuid" : "b12272150db4490ea272150db4190e72"
  }
}

mesh.node.untagged

Emitted when a node was untagged.

Example
{
  "tag" : {
    "name" : "red",
    "uuid" : "e5861ba26b914b21861ba26b91ab211a",
    "tagFamily" : "colors"
  },
  "branch" : {
    "name" : "demoV1",
    "uuid" : "b12272150db4490ea272150db4190e72"
  }
}

mesh.node.published

Emitted whena a node or node content was published.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "type" : "PUBLISHED",
  "branchUuid" : "cd6b4f2851814773ab4f28518137735f",
  "languageTag" : "en"
}

mesh.node.unpublished

Emitted when a node or node content was unpublished.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "type" : "PUBLISHED",
  "branchUuid" : "cd6b4f2851814773ab4f28518137735f",
  "languageTag" : "en"
}

mesh.node.moved

Emitted when a node was moved.

Example
{
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "branchUuid" : "cd6b4f2851814773ab4f28518137735f",
  "schema" : {
    "name" : "folder",
    "uuid" : "cd6b4f2851814773ab4f28518137735f",
    "version" : "1",
    "versionUuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
  },
  "target" : {
    "projectName" : "demo",
    "uuid" : "cd6b4f2851814773ab4f28518137735f",
    "schema" : {
      "name" : "folder",
      "uuid" : "cd6b4f2851814773ab4f28518137735f",
      "version" : "1",
      "versionUuid" : "d84a6f054a3f4ed68a6f054a3f1ed635"
    }
  }
}

mesh.node-content.deleted

Emitted when a content of a node was deleted. (e.g. English language was deleted)

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "type" : "PUBLISHED",
  "branchUuid" : "cd6b4f2851814773ab4f28518137735f",
  "languageTag" : "en"
}

mesh.node-content.created

Emitted when a content of a node was created. (e.g. English translation was added)

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "type" : "PUBLISHED",
  "branchUuid" : "cd6b4f2851814773ab4f28518137735f",
  "languageTag" : "en"
}

mesh.node-reference.updated

Emitted when a referencing node gets indirectly updated. (e.g. via deleting a node in the node list of the referenced node.)

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "branchUuid" : "cd6b4f2851814773ab4f28518137735f"
}

mesh.schema.created

Emitted when a schema was created.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "content"
}

mesh.schema.updated

Emitted when a schema was updated.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "content"
}

mesh.schema.deleted

Emitted when a schema was deleted

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "content"
}

mesh.microschema.created

Emitted when a microschema was created.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "vcard"
}

mesh.microschema.updated

Emitted when a microschema was updated.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "vcard"
}

mesh.microschema.deleted

Emitted when a microschema was deleted.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "vcard"
}

mesh.branch.created

Emitted when a branch was created.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "demoV1",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  }
}

mesh.branch.updated

Emitted when a branch was updated.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "demoV1",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  }
}

mesh.branch.deleted

Emitted when a branch was deleted.

Example
{
  "uuid" : "2619185de0db4a5399185de0dbda53da",
  "name" : "demoV1",
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  }
}

mesh.branch.tagged

Emitted when a branch was tagged.

Example
{
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "branch" : {
    "name" : "demoV1",
    "uuid" : "b12272150db4490ea272150db4190e72"
  },
  "tag" : {
    "name" : "red",
    "uuid" : "e5861ba26b914b21861ba26b91ab211a",
    "tagFamily" : "colors"
  }
}

mesh.branch.untagged

Emitted when a branch was untagged.

Example
{
  "project" : {
    "name" : "demo",
    "uuid" : "ec2f5106764c4d94af5106764ccd948a"
  },
  "branch" : {
    "name" : "demoV1",
    "uuid" : "b12272150db4490ea272150db4190e72"
  },
  "tag" : {
    "name" : "red",
    "uuid" : "e5861ba26b914b21861ba26b91ab211a",
    "tagFamily" : "colors"
  }
}

mesh.search.index.sync.request

Event address which can be used to trigger the sync process.

mesh.search.index.sync.start

Emitted when the index sync process starts.

mesh.search.index.sync.finished

Emitted when the index sync process finishes.

mesh.search.index.clear.request

Event address which will trigger a index clear.

mesh.search.index.clear.start

Emitted when the index clear process starts.

mesh.search.index.clear.finished

Emitted when the index clear process finishes.

mesh.search.process.idle

Emitted when the search interation process has been working and is now in idle.

mesh.search.process.isidle

When emitted, this event will be answered with the current idle status.

mesh.search.flush.request

Event which will cause all pending Elasticsearch requests to be sent.

mesh.search.refresh.request

Event which will cause all search indices to be refreshed, so that changes can be queried.

mesh.graph.backup.start

Emitted once the backup process starts.

mesh.graph.backup.finished

Emitted once the backup process finishes.

mesh.graph.restore.start

Emitted once the restore process starts.

mesh.graph.restore.finished

Emitted once the restore process finishes.

mesh.graph.export.start

Emitted once the graph database export process starts.

mesh.graph.export.finished

Emitted once the graph database export process finishes

mesh.graph.import.start

Emitted once the graph database import process starts.

mesh.graph.import.finished

Emitted once the graph database import process finishes.

mesh.graph.repair.start

Emitted once the repair operation is started.

mesh.graph.repair.finished

Emitted once the repair operation finishes.

mesh.plugin.deploying

Emitted once a plugin is being deployed.

mesh.plugin.deployed

Emitted once a plugin has been deployed.

mesh.plugin.undeploying

Emitted once a plugin is being undeployed.

mesh.plugin.undeployed

Emitted once a plugin has been undeployed.

Custom Events

It is also possible to register and send custom events. The address of those events must start with custom..

Custom events can be used to exchange events in between connected clients.

Examples

IoT Example

The eventbus provides a great way to utilize data of your IoT devices in your frontend application. The following example shows how the Arduino compatible ESP8266 WIFI enabled microcontroller can utilize the Gentics Mesh eventbus.

The shown sketch utilizes the arduinoWebSockets library.

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <WebSocketsClient.h>
#include <Hash.h>

ESP8266WiFiMulti WiFiMulti;
WebSocketsClient webSocket;
#define USE_SERIAL Serial1
const char* ssid     = "Demo";
const char* password = "12345678";
const byte interruptPin = 13; // D7 on Wemos D1 Mini
volatile byte interruptCounter = 0;
int numberOfInterrupts = 0;

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.print("Connecting");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

  // Set the connection details to the Gentics Mesh Server
  webSocket.begin("1.2.3.4", 8080, "{apiLatest}/eventbus/websocket");
  webSocket.setReconnectInterval(2000);
  // Register the interrupt pin
  pinMode(interruptPin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(interruptPin), handleInterrupt, RISING);
}

// Interrupt method which will just count up
void handleInterrupt() {
  interruptCounter++;
}

void loop() {
  // Check whether the connection needs to be re-established
  webSocket.loop();
  // Check whether an interrupt has happend and send an event if needed
  if (interruptCounter > 0) {
    Serial.println("Detected interrupt");
    webSocket.sendTXT("{\"type\":\"publish\",\"address\":\"custom.event\",\"body\":\"someText\"}");
    // Reset the interrupt counter to get ready for the next event
    interruptCounter = 0;
  }
  delay(100);
  // Send a ping to prevent the server to disconnect the connection
  webSocket.sendTXT("{\"type\":\"ping\"}");
}

In this example the Pin 13 (D7) on the ESP8266 will be used to trigger an event.

Limitations

Gentics Mesh does currently not support Webhooks to register to events.