Interface | Description |
---|---|
HibernationHandler |
Callback methods for Hibernation requests and responses.
|
IceServerConfig |
Configuration for ICE Servers.
|
ServiceAuthHandler |
Handle authentication challenge from service.
|
ServiceAuthHandler.Challenge |
Authentication challenge.
|
WSCSession.ConnectionCallback |
Callback for connection notification.
|
Class | Description |
---|---|
HibernateParams |
Parameters for hibernating the session.
|
HttpContext |
HttpContext is used to pass login information between the
HTTP client and the Websocket client API.
|
HttpContext.Builder |
Builder for creating the HttpContext.
|
IceServerConfig.IceServer |
Configuration for an ICE server.
|
JSONHandler | |
Package |
Base class for all packages including Register, Call and others.
|
SessionState |
State of the session.
|
SubSession |
Base class for all interaction classes such as Call.
|
WSCSession |
WSCSession represents a session between the client and the WebRTC Session Controller server.
|
WSCSession.Builder |
Builder for WSCSession class.
|
WSCSession.Observer |
Observer for session state change.
|
To create a session and listen for session state changes:
void loginToWSC() throws URISyntaxException {
final String username = "alice@example.com";
final String webSocketURL = "ws://server:port/ws/webrtc/someapp";
// Add more parameters to builder if required.
final HttpContext httpContext = HttpContext.Builder.create().build();
WSCSession.Builder builder = WSCSession.Builder.create(new URI(webSocketURL))
.withConnectionCallback(new MyConnectionHandler())
.withUserName(username)
.withObserver(new MySessionObserver())
.withPackage(new CallPackage())
.withHttpContext(httpContext)
.withIceServerConfig(new MyIceServerConfig());
// Create the session.
WSCSession session = builder.build();
}
// Handle connection status for the session.
class MyConnectionHandler implements ConnectionCallback {
public void onSuccess() {
// update UI components if any
}
public void onFailure(StatusCode code) {
// display error
}
}
// Pass the configuration of ICE Server(s)...
class MyIceServerConfig implements IceServerConfig {
public Set<IceServer> getIceServers() {
Set<IceServerConfig.IceServer> iceServers = new HashSet<IceServerConfig.IceServer>();
// iceServers.add(...);
return iceServers;
}
}
// Listener for changes in session state.
class MySessionObserver extends WSCSession.Observer {
public void stateChanged(final SessionState state) {
runOnUiThread(new Runnable() {
public void run() {
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;
// handle other cases
}
}
});
}
}