Oracle® Communications WebRTC Session Controller Android API Reference
E55129-01
7.1

Package oracle.wsc.android.session

Session API.

See: Description

Package oracle.wsc.android.session Description

Session API.

To create a session and listen for session state changes:

 String userName = "alice@example.com";
 String webSocketURL = "ws://server:port/ws/webrtc/someapp";

 HttpContext httpContext = HttpContext.Builder.create()...;

 WSCSession.Builder builder = WSCSession.Builder.create(new URI(webSocketURL))
             .withConnectionCallback(new MyConnectionHandler())
             .withUserName(username)
             .withObserver(new MySessionObserver())
             .withPackage(new CallPackage())
             .withHttpContext(httpContext)
             .withIceServerConfig(new MyIceServerConfigImpl());

 // Create the session...
 WSCSession session = builder.build();



 // Handle connection status for the session...
 class MyConnectionHandler implements ConnectionCallback {

   public void onSuccess() {
     ...
   }

   public void onFailure(StatusCode code) {
     ...
   }

 }

 // Pass the configuration of ICE Server(s)...
 class MyIceServerConfigImpl implements IceServerConfig {
    public Set<IceServer> getIceServers() {
       return ...
    }
 }

 // Listener for changes in session state.
 class MySessionObserver extends WSCSession.Observer {

   public void stateChanged(SessionState state) {
    runOnUiThread(new Runnable() {
      switch (state) {
        case CONNECTED:
          // session is connected, update UI to reflect the change.
          break;
        case FAILED:
          // session is reconnecting, update UI to reflect change and possibly re-login.
          break;
        ...
       }
     }
   }
 }

 
Oracle® Communications WebRTC Session Controller Android API Reference
E55129-01
7.1

Copyright © 2013, 2015, Oracle and/or its affiliates. All rights reserved.