lerouxrgd / datachannel-rs

Rust wrappers for libdatachannel
Mozilla Public License 2.0
135 stars 26 forks source link

Compatibility with browser implementations #7

Closed manifest closed 3 years ago

manifest commented 3 years ago

Does this crate aim to be compatible with browser implementations?

I've just noticed that

lerouxrgd commented 3 years ago

Thank you for point that out, it's good thing to keep the same naming indeed. I fixed it on master and it will be available in the next release.

As for deeper browser compatibility I will soon investigate how to seamlessly use the current API with different underlying implementation based on the compilation target:

manifest commented 3 years ago

What about user agents like Firefox or Chrome? I wonder if libdatachannels were tested against their implementations.

paullouisageneau commented 3 years ago

@manifest Yes, libdatachannel is compatible with both Firefox and Chrome.

manifest commented 3 years ago

@paullouisageneau Thanks for clearing this up. Is there any example (in cpp any other language) that I can check out. I wasn't able to make any of the browser work with the current implementation yet.

paullouisageneau commented 3 years ago

Sure, you can find C++ examples here: https://github.com/paullouisageneau/libdatachannel/tree/master/examples

In particular, clientand web examples can connect together.

lerouxrgd commented 3 years ago

Note that this corresponds roughly to the websocket.rs test here.

manifest commented 3 years ago

I was able to create a connection between a browser and a native app. Thanks.

billyb2 commented 3 years ago

@manifest I'm trying to build to the WASM target, but I get this error:

  In file included from apps/app_rand.c:10:
  In file included from apps/apps.h:13:
  In file included from ./e_os.h:16:
  In file included from include/openssl/e_os2.h:243:
  /usr/lib/clang/11.1.0/include/inttypes.h:21:15: fatal error: 'inttypes.h' file not found
  #include_next <inttypes.h>
                ^~~~~~~~~~~~
  1 error generated.
  make[1]: *** [Makefile:680: apps/app_rand.o] Error 1
  make: *** [Makefile:177: build_libs] Error 2
  thread 'main' panicked at '

  Error building OpenSSL:
      Command: "make" "build_libs"
      Exit status: exit status: 2

Do you have any advice?

manifest commented 3 years ago

Hey @billyb2,

I haven't had a need to build the library for the WebAssembly target. IMO the browser's WebAPI is a more natural choice.

lerouxrgd commented 3 years ago

@billyb2 this library is not meant to be compiled in wasm as-is. As @manifest mentioned the browser API should be used instead, here is an example for datachannel.

So for this library this would mean to use a different backend implementation based on the compilation target (while keeping the same public API): if the compilation target is wasm then use wasm-bindgen backend, otherwise use libdatachannel backend.

I have been working on a wasm-bindgen backend to achieve this, however it would break the current public API as it requires some methods to be async. So I have not released it yet and it is still work in progress.

billyb2 commented 3 years ago

Thank you both very much!