diff --git a/README.md b/README.md new file mode 100644 index 0000000..ed140b0 --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ +# Cockpit Real-time Server + +This is a Websocket Middleware server for [Cockpit Headless CMS](https://github.com/agentejo/cockpit). + +You can use the following [Javascript SDK](https://github.com/brunnolou/cockpit-sdk) to get real-time updates. + +## Cockpit Webhook + +Add a Webhook to Cokpit with the following settings: + +* **Url**: `http://localhost:4000/update` + + Or the public address where the server is hosted + +* **Events**: + + You must add at least one event. e.g.: + + - `collections.save.after` + - `collections.save.after.portfolio` + + * ![webhook screenshot](public/webhook.png) + +## Preview collections +Edit each collection and add the following settings: + +* **Preview URL**: _The http url where you can see the changes_. +* **Websocket**: `ws://localhost:4000/` + +- ![webhook screenshot](public/preview.png) + +### Installation + +```sh +npm install +``` + +### Start + +```sh +npm start +``` + +### Development + +```sh +npm start +``` + +### Deployment + +You can easily deploy with [Zeit Now](https://zeit.co/now) + +```sh +npm deploy +``` diff --git a/package.json b/package.json index ec81402..424cfbd 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "start": "node index.js", "dev": "nodemon index.js", - "deploy": "now rm cockpit-real-time && now --public", + "deploy": "now rm cockpit-real-time-server && now --public", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { diff --git a/public/preview.png b/public/preview.png new file mode 100644 index 0000000..82d1473 Binary files /dev/null and b/public/preview.png differ diff --git a/public/webhook.png b/public/webhook.png new file mode 100644 index 0000000..1df496b Binary files /dev/null and b/public/webhook.png differ