public class Session extends Object
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Gracefully closes the Session: unpublishes all streams and evicts every
participant
|
long |
createdAt()
Timestamp when this session was created, in UTC milliseconds (ms since Jan 1,
1970, 00:00:00 UTC)
|
boolean |
fetch()
Updates every property of the Session with the current status it has in
OpenVidu Server.
|
void |
forceDisconnect(Connection connection)
Forces the user represented by
connection to leave the session. |
void |
forceDisconnect(String connectionId)
Forces the user with Connection
connectionId to leave the
session. |
void |
forceUnpublish(Publisher publisher)
Forces some user to unpublish a Stream.
|
void |
forceUnpublish(String streamId)
Forces some user to unpublish a Stream.
|
String |
generateToken()
Gets a new token associated to Session object with default values for
TokenOptions. |
String |
generateToken(TokenOptions tokenOptions)
Gets a new token associated to Session object configured with
tokenOptions. |
List<Connection> |
getActiveConnections()
Returns the list of active connections to the session.
|
SessionProperties |
getProperties()
Returns the properties defining the session
|
String |
getSessionId()
Gets the unique identifier of the Session
|
boolean |
isBeingRecorded()
Returns whether the session is being recorded or not
|
String |
toString() |
public String getSessionId()
public long createdAt()
public String generateToken() throws OpenViduJavaClientException, OpenViduHttpException
TokenOptions. This always translates into a
new request to OpenVidu ServerOpenViduJavaClientExceptionOpenViduHttpExceptionpublic String generateToken(TokenOptions tokenOptions) throws OpenViduJavaClientException, OpenViduHttpException
tokenOptions. This always translates into a new request to
OpenVidu ServerOpenViduJavaClientExceptionOpenViduHttpExceptionpublic void close()
throws OpenViduJavaClientException,
OpenViduHttpException
public boolean fetch()
throws OpenViduJavaClientException,
OpenViduHttpException
getActiveConnections()) and use
those values to call
forceDisconnect(Connection) or
forceUnpublish(Publisher). OpenVidu.fetch()OpenViduHttpExceptionOpenViduJavaClientExceptionpublic void forceDisconnect(Connection connection) throws OpenViduJavaClientException, OpenViduHttpException
connection to leave the session.
OpenVidu Browser will trigger the proper events on the client-side
(streamDestroyed, connectionDestroyed,
sessionDisconnected) with reason set to
"forceDisconnectByServer" connection parameter with
fetch() and then
getActiveConnections()public void forceDisconnect(String connectionId) throws OpenViduJavaClientException, OpenViduHttpException
connectionId to leave the
session. OpenVidu Browser will trigger the proper events on the client-side
(streamDestroyed, connectionDestroyed,
sessionDisconnected) with reason set to
"forceDisconnectByServer" connectionId parameter with
fetch() (use
Connection.getConnectionId() to get the
`connectionId` you want)public void forceUnpublish(Publisher publisher) throws OpenViduJavaClientException, OpenViduHttpException
streamDestroyed) with reason
set to "forceUnpublishByServer".publisher parameter with
getActiveConnections() and then for
each Connection you can call
Connection.getPublishers(). Remember to call
fetch() before to fetch the current
actual properties of the Session from OpenVidu Serverpublic void forceUnpublish(String streamId) throws OpenViduJavaClientException, OpenViduHttpException
streamDestroyed) with reason
set to "forceUnpublishByServer". streamId parameter with
getActiveConnections() and then for
each Connection you can call
Connection.getPublishers(). Finally
Publisher.getStreamId()) will give you the
streamId. Remember to call
fetch() before to fetch the current
actual properties of the Session from OpenVidu Serverpublic List<Connection> getActiveConnections()
fetch() was called.
Exceptions to this rule are:
forceUnpublish(String)
updates each affected Connection statusforceDisconnect(String)
updates each affected Connection statusfetch() and then
getActiveConnections()public boolean isBeingRecorded()
public SessionProperties getProperties()
Copyright © 2020 OpenVidu. All rights reserved.