/// <summary>
        /// Initializes a new instance of the <see cref="SMProtocol"/> class.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <param name="streamsStore">The streams store.</param>
        internal SMProtocol(Uri uri, IStreamStore streamsStore)
        {
            this.streamsStore = streamsStore;
            this.webSocket = new WebSocket(uri.ToString());
            this.webSocket.OnOpen += this.OnSocketOpen;
            this.webSocket.OnPing += this.OnSocketPing;
            this.webSocket.OnClose += this.OnSocketClose;

            this.serializer = new FrameSerializer();
            this.builder = new FrameBuilder();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SMProtocol"/> class.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <param name="streamsStore">The streams store.</param>
        /// <param name="options">Protocol options</param>
        internal SMProtocol(Uri uri, IStreamStore streamsStore, SMProtocolOptions options)
        {
            this.streamsStore       = streamsStore;
            this.webSocket          = new WebSocket(uri.ToString());
            this.webSocket.OnOpen  += this.OnSocketOpen;
            this.webSocket.OnPing  += this.OnSocketPing;
            this.webSocket.OnClose += this.OnSocketClose;

            if (options != null)
            {
                this.options = options;
            }

            this.serializer = new FrameSerializer(this.options);
            this.builder    = new FrameBuilder();
        }