CreateSession() public method

The create_session() method of the OpenTokSDK object to create a new OpenTok session and obtain a session ID.
public CreateSession ( string location, object options = null ) : string
location string n IP address that TokBox will use to situate the session in its global network. In general, you should not pass in a location hint; if no location hint is passed in, the session uses a media server based on the location of the first client connecting to the session. Pass a location hint in only if you know the general geographic region (and a representative IP address) and you think the first client connecting may not be in that region.
options object /// Optional. An object used to define peer-to-peer preferences for the session. /// /// - p2p_preference (p2p.preference) : "disabled" or "enabled" /// - multiplexer_switchType (multiplexer.switchType) /// - multiplexer_switchTimeout (multiplexer.switchTimeout) /// - multiplexer_numOuputStreams (multiplexer.numOutputStreams) /// - echoSuppression_enabled (echoSuppression.enabled) /// ///
return string
コード例 #1
0
        public openTok(string REMOTE_ADDR)
        {
            OpenTok ot = new OpenTok();

            Dictionary<string, object> options = new Dictionary<string, object>();

              options.Add(SessionProperties.P2PPreference, "enabled");

            this.SessionId = ot.CreateSession(REMOTE_ADDR, options);
            this.Token = ot.GenerateToken(this.SessionId);
            this.ApiKey = ConfigurationManager.AppSettings["opentok.key"];
        }