protected ServerConnectionBase(Server.IServerTransport serverTransport, string connectionId)
        {
            if (serverTransport == null)
            {
                throw new ArgumentNullException(nameof(serverTransport));
            }

            if (string.IsNullOrEmpty(connectionId))
            {
                connectionId = Guid.NewGuid().ToString();
            }

            ConnectionId    = connectionId;
            ServerTransport = serverTransport;
        }
Ejemplo n.º 2
0
        public static ServerConnectionBase Create(Server.IServerTransport serverTransport, string connectionId)
        {
            switch (serverTransport.TransportName)
            {
            case "TCPIPV4":
            case "UDPIPV4":
                var transp = (ServerTransportBase <byte[]>)serverTransport;
                var conn   = new ServerConnection <byte[]>(transp, new BinaryProtocol(new byte[50]), connectionId)
                {
                    DeSerializer = new BinaryFormaterGenericSerializer <object>()
                };
                return(conn);

            case "SignalR":
            default:
                throw new ArgumentOutOfRangeException(nameof(serverTransport), "Tranport not found");
            }
        }