// Build WebRtcEndpoint
WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
contentSession.releaseOnTerminate(webRtcEndpoint);
// Check if it is a transmitter or a receiver
Constraints videoConstraints = contentSession.getVideoConstraints();
if (videoConstraints.name().equalsIgnoreCase("SENDONLY")) {
// it means the request is from the transmitter
connection.setTransmitter(webRtcEndpoint, nickName);
contentSession.publishEvent(new ContentEvent("nickname", nickName));
} else {
connection.addReceiver(webRtcEndpoint, contentSession);