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.
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 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
.
This assumes you already have the server compiled.
- Install
doc/initial.sql
into a MySQL/MariaDB database. This can be done with the following command (assuming a database namedkcchat
has been created, this can be renamed to whatever you want):
mysql kcchat < initial.sql
- Rename or copy
doc/config.json.sample
toconfig.json
and place in the same directory as the executable. Openconfig.json
in your preferred editor and start configuring it:
-
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_id
andyoutube_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_name
andbot_color
. -
Optionally, set SSL keys/certificates with
ssl_key
,ssl_crt
, and (optionally)ssl_ca
to 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_id
andpaypal_client_secret
to enable donations. For testing/development in PayPal Sandbox, leavepaypal_live
set 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_live
totrue
. -
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
!time
command regardless of the server's timezone.
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.