summary refs log tree commit diff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-05-24 17:51:06 +0200
committerGitHub <noreply@github.com>2021-05-24 17:51:06 +0200
commit2e1a821601299f212df414262defaf72edbeaa67 (patch)
tree626afe93c2bf9ad7176964f4beb70f2059daf798 /src/main.cpp
parentMerge pull request #19 from ItsNewe/master (diff)
parent[edit] Deprecate gRPC in favor of MongoDB (diff)
downloadserver-2e1a821601299f212df414262defaf72edbeaa67.tar.xz
Merge pull request #20 from ItsNewe/master
[edit] Deprecate gRPC in favor of MongoDB
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp

index 2fdeceee..bd4ebbec 100644 --- a/src/main.cpp +++ b/src/main.cpp
@@ -22,15 +22,24 @@ // #include "rtcPeerHandler.hpp" //Handle peer connection requests -#include "rpcStub.hpp" //Handle gRPC communications between the different fosscord elements +#include "mongoStub.hpp" //Handle communication with the MongoDB server int main(int argc, char **argv){ auto commsHandler = std::make_shared<rtcPeerHandler>(); - auto rpcHandler = std::unique_ptr<rpcStub>(new rpcStub(commsHandler, 8057)); + auto mongoHandler = std::make_unique<mongoStub>(); + mongocxx::options::change_stream options; + mongocxx::change_stream colCs = mongoHandler->getCol().watch(options); + + //Check for new messages in the collection + for (;;){ + std::vector<std::string> t = mongoHandler->getNewMessages(&colCs); + for(auto &i : t){ + std::cout << i << std::endl; + } + } std::cout << "Server created" << std::endl; - //rpcHandler->server->Wait(); //blocking, this will need to be threaded return 0; } \ No newline at end of file