All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.antmedia.webrtc.WebSocketClientConnection Maven / Gradle / Ivy

Go to download

Ant Media Server supports RTMP, RTSP, MP4, HLS, WebRTC, Adaptive Streaming, etc.

There is a newer version: 2.12.0
Show newest version
package io.antmedia.webrtc;

import java.io.UnsupportedEncodingException;

import javax.annotation.Nonnull;

import org.apache.commons.lang3.exception.ExceptionUtils;
import org.red5.net.websocket.WebSocketConnection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class WebSocketClientConnection implements IClientConnection {

	private static Logger logger = LoggerFactory.getLogger(WebSocketClientConnection.class);

	private WebSocketConnection wsConnection;

	public WebSocketClientConnection(@Nonnull WebSocketConnection wsConnection) {
		this.wsConnection = wsConnection;
	} 
	
	@Override
	public void send(String data) {
		try {
			this.wsConnection.send(data);
		} catch (UnsupportedEncodingException e) {
			logger.error(ExceptionUtils.getStackTrace(e));
		}
	}

	@Override
	public String getId() {
		return String.valueOf(this.wsConnection.getId());
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy