JS client description

If you want to use nextrtc js client you have to add to your code following js files:
– adapter.js
– nextRTC.js
Both files are available in project nextrtc-signaling-server in directory resources. Adapter is taken from here, so if you want to use newest version you should take it direct from that project.


NextRTC js client constructor requires:

  • wsURL which should points to your endpoint

    endpointGivenInAnnotation e.g. – @ServerEndpoint(value = “/signaling” …)
  • mediaConfig – are passed straight to adapter, so more information about parametres you can find in webrtc/adapter documentation
  • peerConfig – are also described in webrtc/adapter project

Example is shown below and it’s also available in videochat-example


How to use nextrtc on static page?

When page will be fully loaded you should create nextrtc object.
If you don’t know when your page is fully loaded you can use override method NextRTC.onReady (this way of use is presented in example).

When you create NextRTC object you have to provide function which will be called when event happens.
To register function you have to call method on() as presented in snipped:

There are two signals which are providing other second parameter type. Those signals are:
localStream and remoteStream, when you are handling local audio/video stream and incomming audio/video stream you can simply attach stream to valid element (without additional action like resolving stream by description provided in event).


Event structure is presented below:

Event is serialized java version of message.

Leave a Reply

Your email address will not be published. Required fields are marked *