Giter Club home page Giter Club logo

webrtc-in-rust's Introduction

WebRTC Tutorial in Rust+WASM !

WebRTC in Rust

Quick prerequisites

You will need to install cargo-make and microserver
cargo install --force cargo-make
cargo install microserver

Start Right away

You need two terminals opened in the root directory of the project.

From Terminal 1
Terminal 1 ๐Ÿ›  : cd ./wasm_client
Terminal 1 ๐Ÿ›  : cargo make build or cargo make watch (if you plan on tinkering)
Terminal 1 ๐Ÿš€ : cargo make serve

From Terminal 2:
Terminal 2 ๐Ÿ”Œ : cd ./signalling-server
Terminal 2 ๐Ÿ”Œ : cargo make servesignal

โš ๏ธ Don't forget to set your own ip address for your web-socket's signalling server inside /wasm_client/src/websockets.rs

This is to be read with the following Medium Article.

Useful Terminology

  • ICE : Interactive Connectivity Establishment

  • SCTP : Stream Control Transmission Protocol (SCTP)

  • SDP : Session Description Protocol

  • STUN : Session Traversal Utilities for NAT

  • NAT : Network Address Translation

  • TURN : Traversal Using Relays around NAT

  • Signaling: Signaling is the process of sending control information between two devices to determine the communication protocols, channels, media codecs and formats, and method of data transfer, as well as any required routing information. The most important thing to know about the signaling process for WebRTC: it is not defined in the specification. This is something that be implemented by the programmer, this project makes use of websockets to achieve this.

webrtc-in-rust's People

Contributors

charles-schleich avatar monperrus avatar tomkarw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

webrtc-in-rust's Issues

Error: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.

Hi!

I followed the instructions in the README here and put my IP in websockets.rs, but this project still doesn't seem to work for me.

I can see the buttons and squares on the web page, but when I click the "connect to session" button there is a flurry of errors in the console and nothing appears on the page...

what am I doing wrong here?

Screen Shot 2022-02-13 at 1 13 59 PM

Errors in console:

wasm_client.js:528 ERROR wasm_client/src/common.rs:543 Error Sending SessionJoin JsValue(InvalidStateError: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.Error: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.    at http://localhost:9000/pkg/wasm_client.js:444:25    at http://localhost:9000/pkg/wasm_client.js:294:22    at web_sys::features::gen_WebSocket::WebSocket::send_with_str::h50b26daf6c0aecab (http://localhost:9000/pkg/wasm_client_bg.wasm:wasm-function[402]:0x4cb67)    at wasm_client::common::try_connect_to_session::hffd62b095e285bc6 (http://localhost:9000/pkg/wasm_client_bg.wasm:wasm-function[129]:0x2182f)    at wasm_client::common::setup_initiator::{{closure}}::{{closure}}::ha9c0d620afc1526f (http://localhost:9000/pkg/wasm_client_bg.wasm:wasm-function[193]:0x34d9d)    at <dyn core::ops::function::FnMut<()>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h2f2d581f0729aed8 (http://localhost:9000/pkg/wasm_client_bg.wasm:wasm-function[752]:0x61179)    at __wbg_adapter_31 (http://localhost:9000/pkg/wasm_client.js:259:10)    at HTMLButtonElement.real (http://localhost:9000/pkg/wasm_client.js:201:20))
(anonymous) @ wasm_client.js:528
wasm_client.js:531 INFO wasm_client/src/common.rs:505 sid_inputs sdf
wasm_client.js:528 ERROR wasm_client/src/common.rs:543 Error Sending SessionJoin JsValue(InvalidStateError: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.Error: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.    at http://localhost:9000/pkg/wasm_client.js:444:25    at http://localhost:9000/pkg/wasm_client.js:294:22    at web_sys::features::gen_WebSocket::WebSocket::send_with_str::h50b26daf6c0aecab (http://localhost:9000/pkg/wasm_client_bg.wasm:wasm-function[402]:0x4cb67)    at wasm_client::common::try_connect_to_session::hffd62b095e285bc6 (http://localhost:9000/pkg/wasm_client_bg.wasm:wasm-function[129]:0x2182f)    at wasm_client::common::setup_initiator::{{closure}}::{{closure}}::ha9c0d620afc1526f (http://localhost:9000/pkg/wasm_client_bg.wasm:wasm-function[193]:0x34d9d)    at <dyn core::ops::function::FnMut<()>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h2f2d581f0729aed8 (http://localhost:9000/pkg/wasm_client_bg.wasm:wasm-function[752]:0x61179)    at __wbg_adapter_31 (http://localhost:9000/pkg/wasm_client.js:259:10)    at HTMLButtonElement.real (http://localhost:9000/pkg/wasm_client.js:201:20))
(anonymous) @ wasm_client.js:528
DevTools failed to load source map: Could not load content for chrome-extension://bfnaelmomeimhlpmgjnjophhpkkoljpa/content_script/content_script.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for chrome-extension://bfnaelmomeimhlpmgjnjophhpkkoljpa/content_script/inpage.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
wasm_client.js:440 WebSocket connection to 'ws://192.168.178.60:2794/' failed: 
(anonymous) @ wasm_client.js:440
wasm_client.js:528 ERROR wasm_client/src/websockets.rs:81 WS: onerror_callback error event: ErrorEvent { obj: Event { obj: Object { obj: JsValue(Event) } } }

Error: Couldn't Get Media Stream

When starting a new Session I get this error in the console:
Uncaught (in promise) Error: Couldn't Get Media Stream

A have a working camera and yet it doesn't even ask access to it.
I tried with Firefox as well as Chromium

Do you have any idea where it could come from ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.