Faye - real time messaging
Sends realtime messages to the logged in users. Generally reports things like notifications.What is Faye?
Faye is a websockets implementation that we run on notifications.pixwel.com. The UI subscribes to endpoints - e.g. a user’s browser may subscribe tonotifications.pixwel.com/staging/faye/{my user id} to get notifications for a given user. This endpoint does not have to exist at the time of subscription, but if any messages get pushed to that endpoint, the user’s browser will pick them up.
Where does Faye run?
- On
development, it runs locally - On all other environments, it runs on notifications.pixwel.com with endpoints for the various environments.
Testing Faye
- Open Chrome and open the web sockets tab of Chrome tools
- Log in as User A
- Assert that a web sockets connection is made to Faye
- In an incognito tab, log in as User A and then find User B and click the ‘impersonate’ button for that user
- As User B, share some assets to User A
- As User A, click Notifications in the grey bar and assert that the new share is in there
Infrastructure
notifications.pixwel.com is provisioned through the Ansible (details below).AWS setup
| Name | Type | Purpose |
|---|---|---|
vpc_notifications | Virtual private cluster | Private subcloud for notifications. |
subnet_notifications_b | Subnet | Net in VPC for allocating IPs and containing the cluster. |
sg_notifications_vpc_default | Security group | Define ports 443 and 22 as the only accessible ports. |
igw_notifications | Internet gateway | Everything in vpc_notifications must talk through this internet interface |
route_notifications | Routing table | Defines what routes can happen in the VPC. Ties the gateway to the subnet. |
<varies> | EC2 node | Hosts Faye. Installed as an Upstart job. |
Replacing the notifications server
If the notifications server drifts significantly, or is somehow compromised or lost, you can stand up a new one:ansible/stand_up_new_notifications_server.yaml playbook. It does not use a load balancer because load balancers do not support web sockets.
Once the script has completed, you will need to follow a few manual steps to update DNS.
Back to docs index | Next page in recommended reading order >>