brkho / client-server-webrtc-example Goto Github PK
View Code? Open in Web Editor NEWAn example for using WebRTC to communicate between a JavaScript client and a C++ server.
License: MIT License
An example for using WebRTC to communicate between a JavaScript client and a C++ server.
License: MIT License
See https://github.com/blockspacer/webrtc-datachannels as example
Hi @brkho
I have tried out your code repo on Ubuntu 16.04 It throws this error:
In function SignalThreadEntry():
main.cpp:(.text+0x2ac3): undefined reference to rtc::MessageQueue::set_socketserver(rtc::SocketServer*)
main.cpp:(.text+0x2aeb): undefined reference to rtc::MessageQueue::set_socketserver(rtc::SocketServer*)
Tried including these in main.cpp
file
#include <webrtc/base/thread.h>
#include <webrtc/base/messagequeue.h>
It didn't resolve it either. Any leads are appreciated :)
Thanks.
I can't compile server,
Could you please give me a demo, I want to play the game.
Thanks a lot.
Hello, thank you for your very useful project. After struggling several days I realized your example doesn't work in NAT traversal with google STUN servers. I don't know exactly why, but I followed a comment that suggested to change the servers. I configured it like this (urls found from list of public servers):
iceServers: [{ urls: ["stun:iphone-stun.strato-iphone.de:3478", "stun:stun01.sipphone.com"] }]
And your example worked perfectly allowing a client in a Full-Cone NAT to communicate with an AWS vm (Port-Restricted NAT). This was the single point of failure in my code. Reverting it to use google STUN and the example wasn't working anymore.
As a side node: I noticed you issue creation of data channel in both sides (client js and server cpp) which shouldn't be needed, as mentioned here. After cleaning this, I was able to establish data channel with STUN server just configured in the client.
Have you tested this library to see the maximum amount of clients it can handle?
Thank you very much for this example, I got data channels working. But there is great difficulty getting video streaming to work. Mostly because server to peer is so undocumented on the WWW.
Thanks.
Hi,
i try to cross compile it for a raspberry. I successfully cross compile libwebrtc and boost for arm but when i try to compile i get this error:
root@codebook:~/client-server-webrtc-example/server/out# make -j4 /usr/bin/cmake -H/root/client-server-webrtc-example/server -B/root/client-server-webrtc-example/server/out --check-build-system CMakeFiles/Makefile.cmake 0 /usr/bin/cmake -E cmake_progress_start /root/client-server-webrtc-example/server/out/CMakeFiles /root/client-server-webrtc-example/server/out/CMakeFiles/progress.marks make -f CMakeFiles/Makefile2 all make[1]: Entering directory '/root/client-server-webrtc-example/server/out' make -f CMakeFiles/server_exe.dir/build.make CMakeFiles/server_exe.dir/depend make[2]: Entering directory '/root/client-server-webrtc-example/server/out' cd /root/client-server-webrtc-example/server/out && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/client-server-webrtc-example/server /root/client-server-webrtc-example/server /root/client-server-webrtc-example/server/out /root/client-server-webrtc-example/server/out /root/client-server-webrtc-example/server/out/CMakeFiles/server_exe.dir/DependInfo.cmake --color= make[2]: Leaving directory '/root/client-server-webrtc-example/server/out' make -f CMakeFiles/server_exe.dir/build.make CMakeFiles/server_exe.dir/build make[2]: Entering directory '/root/client-server-webrtc-example/server/out' [ 50%] Building CXX object CMakeFiles/server_exe.dir/src/test.cpp.o /opt/raspy/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -DWEBRTC_POSIX -D_GLIBCXX_USE_CXX11_ABI=0 -I/usr/local/include -I/root/client-server-webrtc-example/server/src -I/opt/raspy/libwebrtc/out/lib -I/opt/raspy/libwebrtc/out/include -I/usr/local/boost/include -I/usr/local/boost/lib -I/usr/local/lib -I/root/client-server-webrtc-example/server/out -Wall -Wextra -Wpedantic -std=gnu++0x -pthread -Wall -o CMakeFiles/server_exe.dir/src/test.cpp.o -c /root/client-server-webrtc-example/server/src/test.cpp /root/client-server-webrtc-example/server/src/test.cpp:17:42: warning: unused parameter 's' [-Wunused-parameter] void OnWebSocketMessage(WebSocketServer* s, websocketpp::connection_hdl hdl, message_ptr msg) { ^ /root/client-server-webrtc-example/server/src/test.cpp:17:73: warning: unused parameter 'hdl' [-Wunused-parameter] void OnWebSocketMessage(WebSocketServer* s, websocketpp::connection_hdl hdl, message_ptr msg) { ^ [100%] Linking CXX executable //root/client-server-webrtc-example/server/out/bin/example-server /usr/bin/cmake -E cmake_link_script CMakeFiles/server_exe.dir/link.txt --verbose=1 /opt/raspy/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -Wall -Wextra -Wpedantic -std=gnu++0x -pthread -rdynamic CMakeFiles/server_exe.dir/src/test.cpp.o -o //root/client-server-webrtc-example/server/out/bin/example-server -L/usr/local/lib -Wl,-rpath,/usr/local/lib /usr/local/boost/lib/libboost_system.a -lpthread /usr/local/boost/lib/libboost_system.a(error_code.o): In function
boost::system::detail::generic_error_category::messageabi:cxx11 const':
error_code.cpp:(.text+0x9e): undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned int&, unsigned int)' error_code.cpp:(.text+0x110): undefined reference to
std::__cxx11::basic_string<char, std::char_traits, std::allocator >::~basic_string()'
/usr/local/boost/lib/libboost_system.a(error_code.o): In function boost::system::detail::system_error_category::~system_error_category()': error_code.cpp:(.text._ZN5boost6system6detail21system_error_categoryD2Ev[_ZN5boost6system6detail21system_error_categoryD5Ev]+0x1a): undefined reference to
std::_V2::error_category::~error_category()'
/usr/local/boost/lib/libboost_system.a(error_code.o): In function boost::system::detail::system_error_category::~system_error_category()': error_code.cpp:(.text._ZN5boost6system6detail21system_error_categoryD0Ev[_ZN5boost6system6detail21system_error_categoryD5Ev]+0x1a): undefined reference to
std::_V2::error_category::~error_category()'
error_code.cpp:(.text._ZN5boost6system6detail21system_error_categoryD0Ev[_ZN5boost6system6detail21system_error_categoryD5Ev]+0x22): undefined reference to operator delete(void*, unsigned int)' /usr/local/boost/lib/libboost_system.a(error_code.o): In function
boost::system::detail::generic_error_category::~generic_error_category()':
error_code.cpp:(.text._ZN5boost6system6detail22generic_error_categoryD2Ev[_ZN5boost6system6detail22generic_error_categoryD5Ev]+0x1a): undefined reference to std::_V2::error_category::~error_category()' /usr/local/boost/lib/libboost_system.a(error_code.o): In function
boost::system::detail::generic_error_category::~generic_error_category()':
error_code.cpp:(.text._ZN5boost6system6detail22generic_error_categoryD0Ev[_ZN5boost6system6detail22generic_error_categoryD5Ev]+0x1a): undefined reference to std::_V2::error_category::~error_category()' error_code.cpp:(.text._ZN5boost6system6detail22generic_error_categoryD0Ev[_ZN5boost6system6detail22generic_error_categoryD5Ev]+0x22): undefined reference to
operator delete(void*, unsigned int)'
collect2: error: ld returned 1 exit status
CMakeFiles/server_exe.dir/build.make:98: recipe for target '//root/client-server-webrtc-example/server/out/bin/example-server' failed
make[2]: *** [//root/client-server-webrtc-example/server/out/bin/example-server] Error 1
make[2]: Leaving directory '/root/client-server-webrtc-example/server/out'
CMakeFiles/Makefile2:70: recipe for target 'CMakeFiles/server_exe.dir/all' failed
make[1]: *** [CMakeFiles/server_exe.dir/all] Error 2
make[1]: Leaving directory '/root/client-server-webrtc-example/server/out'
Makefile:86: recipe for target 'all' failed
make: *** [all] Error 2
`
any suggestion to solve this?
Thanks
When running CMake I get libscourcey.cmake is missing error. Is there any workaround for this?
CMake Error at CMakeLists.txt:18 (include):
include could not find load file:
../libsourcey/LibSourcey.cmake
Thanks!
M
The data channel is not working for me, can anyone please tell me how can I connect with the data channel in this example code.
Thanks.
I am not able to compile it after "make" command it is stuck nothing happened ,can anyone tell me how to run this code to make it work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.