ColinLefter / Accord

A real-time privacy-first social media platform leveraging feature-rich direct messaging text channels. Built as part of the course project for COSC 310 at UBC.
5 stars 1 forks source link

Configuring Real Time Messaging with Ably #118

Open ColinLefter opened 5 months ago

ColinLefter commented 5 months ago

Overview

Ably is the real-time messaging provider that I have selected for our project. They act as a third-party that provides a cloud solution to handling real-time text messages by handling the sending and receiving of text messages. They also store message history for us on their own servers. If you want to learn more about how Ably works, here is the page on Ably on live chat and Pub/Sub Channels. As a quick summary, text messaging works by publishing and subscribing to channels. A channel is between 1 to many users (yes, you can talk to yourself) and in contrast to the idea of targeting a recipient of a message, you rather get them to subscribe to a channel in which they will continue to receive real-time messages unless they unsubscribe (i.e. delete a chat).

The messaging system is still being finalized, but the connection has been established with the provider. Once I finish my tasks for this sprint, we will be able to select users to chat with.

Setup

Please add the following to your .env file

ABLY_API_KEY_PUBLISH_SUBSCRIBE=yourapikey

Replace yourapikey with the key given to you.

Dependencies

You will need to run this command before you start up the application.

Known Issues

If you get Auth.requestToken(): input must not start with a slash when using prefixUrl, there is a known issue with the Ably package where got, which is the HTTP client used by Ably when used in NodeJS, fails to make an HTTP request to a URL which starts with a /. To fix this, do the following in the frontend folder:

npm cache clean --force
rm -rf node_modules
npm install