public ClientMsg PublishWithAttachments(string topic, List <string> attachments, ChatMessage msg) { var tid = GetNextTid(); StringBuilder builder = new StringBuilder(); builder.Append("["); foreach (var attach in attachments) { builder.Append($"\"{attach}\","); } builder.Remove(builder.Length - 1, 1); builder.Append("]"); var pub = new ClientPub() { Id = tid, Topic = topic, NoEcho = true, Content = ByteString.CopyFromUtf8(msg.ToString()) }; pub.Head.Add("attachments", ByteString.CopyFromUtf8(builder.ToString())); pub.Head.Add("mime", ByteString.CopyFromUtf8("\"text/x-drafty\"")); return(new ClientMsg() { Pub = pub }); }
public ClientMsg Publish(string topic, ChatMessage msg) { var tid = GetNextTid(); var pub = new ClientPub() { Id = tid, Topic = topic, NoEcho = true, Content = ByteString.CopyFromUtf8(msg.ToString()) }; pub.Head.Add("mime", ByteString.CopyFromUtf8("\"text/x-drafty\"")); return(new ClientMsg() { Pub = pub }); }