Git Product home page Git Product logo

Comments (2)

pchab avatar pchab commented on August 12, 2024

Hello,

Thank you for your interest in my project. The easiest way to add text chat
imo would be to use the socket.io channel to send messages. It already
support a chat room functionality. As you can see in the code, I've
implemented 2 kind of message, "id" and "message" (which could be confusing
in your case, I should probably rename it to "signal" or something like
that). Just add a third kind of message (like "chat"). That way, I don't
think it would be too much work to add this functionality.

On Mon, May 4, 2015 at 10:18 AM, dwsrumwq7cyey7qv [email protected]
wrote:

Hello,
I am thankful for the project and I am especially interested in the
combination of the web und android client. The video communication works
wonderful, but I am searching for a way to extend the project for a chat
functionality.
As far as I understood, the node.js server creates a stream for each
participant. Is it possible to use this stream to also pass on textual
data? Or should there be an additional stream, such that there are two
streams - one for audio/ video and text? How should this functionality be
implemented on android?
Thank you in advice!


Reply to this email directly or view it on GitHub
#13.

from projectrtc.

KristjanLiiva avatar KristjanLiiva commented on August 12, 2024

Just as an addon, you can also use WebRTC DataChannel. This way the messages are not sent over the node js server. Example code, for WebRtcClient.java, for the AndroidRTC. And in the Web client should implement the onDataChannel.

private class Peer implements SdpObserver, PeerConnection.Observer {
        private PeerConnection pc;
        private DataChannel dc;
        ...

        private class DcObserver implements DataChannel.Observer {
            @Override
            public void onMessage(DataChannel.Buffer buffer) {

                // as an example write a response back
                String response = "Response message";
                ByteBuffer send = ByteBuffer.wrap(response.getBytes());
                dc.send(new DataChannel.Buffer(send, false));
            }

            @Override
            public void onStateChange(){

            }
        }
        public Peer(String id, int endPoint) {
            Log.d(TAG,"new Peer: "+id + " " + endPoint);
            this.pc = factory.createPeerConnection(iceServers, pcConstraints, this);
            this.id = id;
            this.endPoint = endPoint;

            pc.addStream(localMS); //, new MediaConstraints()
            dc = pc.createDataChannel("sendDataChannel", new DataChannel.Init());
            DcObserver dcObserver = new DcObserver();
            dc.registerObserver(dcObserver);

            mListener.onStatusChanged("CONNECTING");
        }
}

I just wrote it and it works together with a web page that is implementing the onDataChannel. But for some reason I could not get it working when the web client calls createDataChannel. The onDataChannel is never called in Android. In any case, I am sure it is something that i have missed somewhere. Just thought it might help someone.

from projectrtc.

Related Issues (20)

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.