Пример #1
0
        /// <summary>
        /// Identify creates a new Command to provide information about the client.  After connecting,
        /// it is generally the first message sent.
        ///
        /// The supplied map is marshaled into JSON to provide some flexibility
        /// for this command to evolve over time.
        ///
        /// See http://nsq.io/clients/tcp_protocol_spec.html#identify for information
        /// on the supported options
        /// </summary>
        public static Command Identify(IdentifyRequest request)
        {
            byte[] body;

            var serializer = new DataContractJsonSerializer(typeof(IdentifyRequest));

            using (var memoryStream = new MemoryStream())
            {
                serializer.WriteObject(memoryStream, request);
                body = memoryStream.ToArray();
            }

            return(new Command(IDENTIFY_BYTES, body));
        }
Пример #2
0
        /// <summary>
        /// Identify creates a new Command to provide information about the client.  After connecting,
        /// it is generally the first message sent.
        ///
        /// The supplied map is marshaled into JSON to provide some flexibility
        /// for this command to evolve over time.
        ///
        /// See http://bitly.github.io/nsq/clients/tcp_protocol_spec.html#identify for information
        /// on the supported options
        /// </summary>
        public static Command Identify(IdentifyRequest request)
        {
            byte[] body;

            var serializer = new DataContractJsonSerializer(typeof(IdentifyRequest));

            using (var memoryStream = new MemoryStream())
            {
                serializer.WriteObject(memoryStream, request);
                body = memoryStream.ToArray();
            }

            return new Command(IDENTIFY_BYTES, body);
        }