summary refs log tree commit diff
path: root/rtc/src/main.cpp
blob: 372eaa0086f51046978b310c335c72e24cc771f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//   $$$$$$\                                                                   $$\                           
//  $$  __$$\                                                                  $$ |
//  $$ /  \__|$$$$$$\   $$$$$$$\  $$$$$$$\  $$$$$$$\  $$$$$$\   $$$$$$\   $$$$$$$ |
//  $$$$\    $$  __$$\ $$  _____|$$  _____|$$  _____|$$  __$$\ $$  __$$\ $$  __$$ |
//  $$  _|   $$ /  $$ |\$$$$$$\  \$$$$$$\  $$ /      $$ /  $$ |$$ |  \__|$$ /  $$ |
//  $$ |     $$ |  $$ | \____$$\  \____$$\ $$ |      $$ |  $$ |$$ |      $$ |  $$ |
//  $$ |     \$$$$$$  |$$$$$$$  |$$$$$$$  |\$$$$$$$\ \$$$$$$  |$$ |      \$$$$$$$ |
//  \__|      \______/ \_______/ \_______/  \_______| \______/ \__|       \_______|
//
//
//
//                       $$\                      $$$$$$\                                                    
//                       \__|                    $$  __$$\                                                   
//  $$\    $$\  $$$$$$\  $$\  $$$$$$$\  $$$$$$\  $$ /  \__| $$$$$$\   $$$$$$\ $$\    $$\  $$$$$$\   $$$$$$\  
//  \$$\  $$  |$$  __$$\ $$ |$$  _____|$$  __$$\ \$$$$$$\  $$  __$$\ $$  __$$\\$$\  $$  |$$  __$$\ $$  __$$\ 
//   \$$\$$  / $$ /  $$ |$$ |$$ /      $$$$$$$$ | \____$$\ $$$$$$$$ |$$ |  \__|\$$\$$  / $$$$$$$$ |$$ |  \__|
//    \$$$  /  $$ |  $$ |$$ |$$ |      $$   ____|$$\   $$ |$$   ____|$$ |       \$$$  /  $$   ____|$$ |
//     \$  /   \$$$$$$  |$$ |\$$$$$$$\ \$$$$$$$\ \$$$$$$  |\$$$$$$$\ $$ |        \$  /   \$$$$$$$\ $$ |
//      \_/     \______/ \__| \_______| \_______| \______/  \_______|\__|         \_/     \_______|\__|
//
//
//

#include "rtcPeerHandler.hpp" //Handle peer connection requests
#include "mongoStub.hpp"	//Handle communication with the MongoDB server

int main(int argc, char **argv){

	auto commsHandler = std::make_shared<rtcPeerHandler>();
	auto mongoHandler = std::make_unique<mongoStub>();

	mongocxx::options::change_stream options;
	//voiceEvents collection watcher
    mongocxx::change_stream colCs = mongoHandler->getCol().watch(options);

	std::cout << "Server created and listening for events" << std::endl;

	//Check for new messages in the collection
	for (;;){
		std::vector<mongoStub::mongoMessage> t = mongoHandler->getNewMessages(&colCs);
		for(auto &i : t){
			std::cout << "[" << i.eventName << "] " << std::endl;
		}
	}

	return 0;
}