Beispiel #1
0
        // link channel to dispatcher
        private IConnectionChannel RegisterChannel(IChannel channel, IDispatcher <IConnectionSession> dispatcher, JsonMessageFactory factory, Func <IConnectionSession, bool> shouldOpen)
        {
            dispatchers.Add(dispatcher);
            var connectionChannel = new ConnectionChannel(channel, factory, dispatcher, shouldOpen, MessageLogger);

            connection.OnConnected(session => OnSessionConnected(session, connectionChannel));
            connectionChannel.OnReceived((session, bytes) => OnReceive(connectionChannel, new ConnectionSession(session), bytes));
            return(connectionChannel);
        }