Meant to be a real time chat application, with features similar to discord (a clone basically). It's a self hosted web application with the back end implementation in c++ with support for different clients. The wrongthink protocol is defined & implemented using gRPC.
Matrix room: #wrongthink:matrix.org
wrongthink.cpp
- contains code to configure & start the servertest/
- contains all unit teststest_client.cpp
- test showing a simple gRPC client implemented in c++, now depricated in favor of unit testsprotocol/proto/wrongthink.proto
- protobuf datatype & RPC service definintionsWrongthinkServiceImpl.*
- class implementing the gRPC service defined in wrongthink.proto
SynchronizedChannel.*
- channel communication synchronizationDB
- contains the abstract class defining the database interface & concrete class implementationsInterceptors
- some classes defining gRPC interceptors. These are currently used for logging & authentication purposes.Because the HTTP/2 streaming APIs are not yet fully implemented in web browsers, the Envoy proxy can be used with gRPC web to allow web browsers to communicate with gRPC servers. This is required when using the wrongthink web UI. In this setup, Envoy is deployed along side the wrongthink server, and proxies messages sent via gRPC-web (javascript) to the gRPC server. See https://grpc.io/docs/platforms/web/ & https://github.com/grpc/grpc-web for details. Once the HTTP/2 streaming apis are fully implemented in web browsers, Envoy will be eliminated from the server deployment. For details on building Envoy, see https://www.envoyproxy.io/docs/envoy/latest/start/building.
Most of the dependencies are included in the build, they are located in the third_party
directory. Postgresql needs to be installed separately. The postgresql libpq
library is used by SOCI
for database access, but this should be included by default in the Postgresql installation. You may need to tweak the include directories in the CMakeLists.txt
file depending on where the libpq header files are installed on your system:
# include directories
target_include_directories(wrongthink PUBLIC
include
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/soci/include
/usr/local/include/
/usr/include/postgresql
)
Postgres can either be manually set up locally, or automatically using docker
sudo apt install git build-essential cmake libpq-dev libsqlite3-0 libsqlite3-dev libboost-all-dev binutils
Once postgresql is installed, the following needs to be done manually prior to running the wrongthink server:
wrongthink
with password test
wrongthink
that's owned by the wrongthink userInstall docker and docker-compose. The docker package is docker.io
on debian based systems due to a naming conflict but the compose package should be docker-compose
.
From the project root the following commands can then be used to control the database container:
sudo docker-compose up -d
- Start the databasesudo docker-compose down
- Stop the databasesudo docker-compose logs
- View the logssudo docker-compose rm
- Remove the database container so it can be started freshgit clone https://github.com/ophiuchus2/wrongthink.git --recurse-submodules
cd wrongthink
mkdir -p cmake/build
cd cmake/build
cmake ../..
make
cmake/build
You should see the following files produced during the build:
wrongthink
- server binarytest_client
- client binarytests
- unit test binarywrongthink.grpc*
- grpc generated files
wrongthink.pb*
- protobuf generated files
Server output
./wrongthink
wrongthink version: 0.1
Server listening on 0.0.0.0:50051
Client output
note: the client has not been updated for some time and is now depricated
./test_client
got channel: channel 1
got channel: channel 2
got channel: channel 3
The client creates 3 channels on the server, then retrieves them & prints their names to the console.
Simply execute the tests
binary after a successful build. The tests use these default DB connection settings:
WrongthinkUtils::setupPostgres("wrongthink", "test", "testdb");