Example #1
0
        /// <summary>
        /// Binds the request listener with the socket so that the opening/reading/closing events of the socket are notified to the listener.
        /// Returns false if the socket can't be bound.
        /// </summary>
        public virtual bool switchListener(Uri uri, NettyRequestListener socketListener, NettyInterruptionHandler interruptionHandler)
        {
            lock (this)
            {
                if (this.@is(OPEN))
                {
                    socketListener.onOpen();
                }
                else if (this.@is(OCCUPIED) || this.@is(CLOSED))
                {
                    //should never happen! what do we do? XXX
                    return(false);
                } //else if is init we'll get the onOpen later

                this.uri            = uri;
                this.socketListener = socketListener;
                switchInterruptionHandler(interruptionHandler);
                this.lineAssembler = new LineAssembler(socketListener);
                return(true);
            }
        }
Example #2
0
 public WebSocketChannelHandler(RequestListener networkListener, MyChannel ch)
 {
     this.reqListenerDecorator = new RequestListenerDecorator(networkListener, ch);
     this.lineAssembler        = new LineAssembler(reqListenerDecorator);
 }