kcchat-server
kcchat-server copied to clipboard
KC Chat Backend
KC Chat Backend
This is the server backend that runs the live chat at mattkc.com/live. It is written in C++ and relies heavily on Qt 5+ and MySQL/MariaDB.
Building
The server should compile on any system with CMake and Qt 5+ available. It requires the following Qt modules: Core, Sql (MySQL/MariaDB), Network, and WebSockets. Once you have those installed through whatever means are available for your OS, building should be as simple as:
$ git clone https://github.com/itsmattkc/kcchat-server.git
$ cd kcchat-server
$ mkdir build
$ cd build
$ cmake ..
$ make
Binaries (Ubuntu 20.04)
Binaries for Ubuntu 20.04 are available from the Actions tab. To run on Ubuntu 20.04, you will need the following dependencies installed from apt: libqt5core5a, libqt5network5, libqt5sql5-mysql, libqt5websockets5.
Quick Start
This assumes you already have the server compiled.
- Install
doc/initial.sqlinto a MySQL/MariaDB database. This can be done with the following command (assuming a database namedkcchathas been created, this can be renamed to whatever you want):
mysql kcchat < initial.sql
- Rename or copy
doc/config.json.sampletoconfig.jsonand place in the same directory as the executable. Openconfig.jsonin your preferred editor and start configuring it:
Configuration (config.json)
-
Enter the MySQL/MariaDB details necessary for accessing your database into
db_host,db_port,db_user,db_pass, anddb_name. -
Enter a valid Google cloud/developer client ID and secret into
youtube_client_idandyoutube_client_secret. This is currently the only option for authenticating users (though more will be added later). -
Optionally, configure the bot's in-chat display name and color with
bot_nameandbot_color. -
Optionally, set SSL keys/certificates with
ssl_key,ssl_crt, and (optionally)ssl_cato run the server on the securedwss://protocol rather thanws://. Many browsers require this if the server isn't running onlocalhost. -
Optionally, enter a valid PayPal developer client ID/secret into
paypal_client_idandpaypal_client_secretto enable donations. For testing/development in PayPal Sandbox, leavepaypal_liveset tofalse(Sandbox-specific client ID/secret will also be expected). To start accepting real monetary donations in production, set the client ID/secret to live (i.e. non-sandbox) credentials, and setpaypal_livetotrue. -
Optionally, set a timezone to a valid IANA ID representing the timezone of the streamer. This is used to display the streamer's local time correctly with the
!timecommand regardless of the server's timezone.
Warning: Unstable
This code is still under development. The API/communication protocol is not currently considered stable and may change without warning. A stable release/protocol/API may be released at a later date.