2017-02-23 6 views
0

私は(のWebRTCとkurentoに基づいて、私はプロジェクトに取り組んされます後に)目的を学習するためのサンプルプロジェクトを作成しています、私はそれでKurentoメディアサーバーを使用していますが、私はkurentoサーバのチュートリアルを変形して一つのサンプルを作りましたそれの。彼らはUserSessionのオブジェクトを格納しているUserRegistry.javaを使用しているKurento Serverのサンプルの全てにおいて WebRTCでセッションが必要ですか?

は、以下に示すよう:

  1. public class UserSession { 
    
        private static final Logger log = LoggerFactory.getLogger(UserSession.class); 
    
        private final String name; 
        private final WebSocketSession session; 
    
        private String sdpOffer; 
        private String callingTo; 
        private String callingFrom; 
        private WebRtcEndpoint webRtcEndpoint; 
        private WebRtcEndpoint playingWebRtcEndpoint; 
        private final List<IceCandidate> candidateList = new ArrayList<>(); 
    
        public UserSession(WebSocketSession session, String name) { 
        this.session = session; 
        this.name = name; 
        } 
    
        public void sendMessage(JsonObject message) throws IOException { 
        log.debug("Sending message from user '{}': {}", name, message); 
        session.sendMessage(new TextMessage(message.toString())); 
        } 
    
        public String getSessionId() { 
        return session.getId(); 
        } 
    
        public void setWebRtcEndpoint(WebRtcEndpoint webRtcEndpoint) { 
        this.webRtcEndpoint = webRtcEndpoint; 
    
        if (this.webRtcEndpoint != null) { 
         for (IceCandidate e : candidateList) { 
         this.webRtcEndpoint.addIceCandidate(e); 
         } 
         this.candidateList.clear(); 
        } 
        } 
    
        public void addCandidate(IceCandidate candidate) { 
        if (this.webRtcEndpoint != null) { 
         this.webRtcEndpoint.addIceCandidate(candidate); 
        } else { 
         candidateList.add(candidate); 
        } 
    
        if (this.playingWebRtcEndpoint != null) { 
         this.playingWebRtcEndpoint.addIceCandidate(candidate); 
        } 
        } 
    
        public void clear() { 
        this.webRtcEndpoint = null; 
        this.candidateList.clear(); 
        } 
    } 
    

    が、私はこの上に2つの質問がありますセッションオブジェクトが必要なのはなぜですか?

  2. セッションを管理するための代替案(存在する場合)は何ですか?

私は第二の質問にいくつかのより多くの背景を挙げてみましょう。クライアント側でのみKurento-JavaScript-Clientを実行できることを知りました。(ブラウザのバージョンに変換してから使用できます)(バックエンドサーバーは必要ありません。つまりnodejsまたはtomcat - これは私の前提です)。したがって、この場合、どのようにセッションを管理するのか、あるいはUserRegistryコンセプトを完全に削除して、他の方法で使用することができます。

おかげ&よろしく

答えて

0

あなたは、クライアントとアプリケーションサーバ間のシグナリングを実装するためにセッションを保存する必要があります。例えばhereを参照してください。信号図は、WebRTCビデオ通信の開始/停止/などに必要なメッセージを示しています。

アプリケーションサーバーを取り除く(JavaScriptクライアントに完全に移行する)場合は、PubNubなどのパブリッシュ/サブスクライブAPIを参照してください。

+0

おかげで、私はまだ疑問を持って、私はすなわちのみ、クライアントからのセッションを作成し、クライアント側から完全にKurento-JS-クライアントを使用することができ、またはそれはどのようなセキュリティ上の問題が含まれるのでしょうか?私はこのために独自のソフトウェア/サービスを使用したくない。 –

+0

もちろん、Kurentoはオープンソース(Apache 2.0ライセンス)です。 –

関連する問題