Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some docs #1

Open
antonkulaga opened this issue Jan 11, 2015 · 5 comments
Open

add some docs #1

antonkulaga opened this issue Jan 11, 2015 · 5 comments

Comments

@antonkulaga
Copy link
Contributor

Please, add some docs

@OlivierBlanvillain
Copy link
Owner

Hey, do you think this small readme and the ScalaDoc are enough?

@antonkulaga
Copy link
Contributor Author

Yes, it is better now.
It would be nice to see some explanations of core concepts to make it easier to get started with WebRTC video chats ( not only one 2 one but also in one 2 many and many 2 many video broadcasting configurations) as not all things are clear from examples

@OlivierBlanvillain
Copy link
Owner

The library only supports WebRTC data channels, which is limited to the exchange of strings.

Regarding general message broadcast, there is nothing included in the library either. OOTB Transports are only one-to-one links that have functionality added on top of the implementation.

@antonkulaga
Copy link
Contributor Author

Regarding general message broadcast, there is nothing included in the library either.

It would be nice to have something. For instance in case of WebRTC datachannels it can be used to exchange data directly between clients ommiting the server, in such case one-2-many broadcasting will be usefull.

@OlivierBlanvillain
Copy link
Owner

Something like this?

/** Combines several connections passed in arguments and returns the resulting broadcast
 *  connection. Messages send through the broadcast are copied and sent over each of the
 *  combined connections. Messages received from any of the combined connections are
 *  forwarded to the broadcast connection. Closing the broadcast connection closes all
 *  combined connections, and the broadcast connection is closed when when any of the
 *  combined connection is closed. */
def trivialBroadcast(cs: ConnectionHandle*)(implicit ec: ExecutionContext): ConnectionHandle = {
  val queueablePromise = QueueablePromise[MessageListener]
  val closePromise = Promise[Unit]
  cs.foreach(_.handlerPromise.success(message => queueablePromise.queue(_(message))))
  cs.foreach(_.closedFuture.foreach(_ => closePromise.trySuccess(())))
  new ConnectionHandle {
    def handlerPromise: Promise[MessageListener] = queueablePromise
    def write(message: String): Unit = cs.foreach(_.write(message))
    def closedFuture: Future[Unit] = closePromise.future
    def close(): Unit = cs.foreach(_.close())
  }
}

I feel that any real life application would need something way more complicated that this, for instance if any kind of consistency is needed, and I'm sure if something that simple would be useful to anyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants