CSharpRTMP.Core.Protocols.Rtmfp.FlowWriter.WriteAMFResponse C# (CSharp) Method

WriteAMFResponse() public method

public WriteAMFResponse ( string name, string code, string description ) : AMFObjectWriter
name string
code string
description string
return AMFObjectWriter
        public AMFObjectWriter WriteAMFResponse(string name, string code, string description)
        {
            var message = CreateBufferedMessage();
            WriteResponseHeader(message.Writer,name,CallbackHandle);
            var entireCode = Obj;
            if (!string.IsNullOrEmpty(code))
            {
                entireCode += "." + code;
                this.Log().Info(entireCode);
            }
            var precValue = message.Writer.AMF0Preference;
            message.Writer.AMF0Preference = true;
            var writer = new AMFObjectWriter(message.Writer)
            {
                ["level"] = name == "_error" ? "error" : "status",
                ["code"] = entireCode
            };
            if (!string.IsNullOrEmpty(description)) writer["description"] = description;
            message.Writer.AMF0Preference = precValue;
            return writer;
        }