public void SendBytes(byte[] data, bool compress = false, bool encrypt = false, bool close = false) { var builder = new SimpleMessage(MessageType.Bytes, this, Debug) .CompressMessage(compress) .EncryptMessage(encrypt) .SetBytes(data); builder.Build(); SendToSocket(builder.PayLoad, close, false); }
public void SendMessage(string message, bool compress = false, bool encrypt = false, bool close = false) { var messageBuilder = new SimpleMessage(MessageType.Message, this, Debug) .CompressMessage(compress) .EncryptMessage(encrypt) .SetMessage(message); messageBuilder.Build(); SendToSocket(messageBuilder.PayLoad, close, false); }
public void SendCustomHeader(string message, string header, bool compress = false, bool encrypt = false, bool close = false) { var builder = new SimpleMessage(MessageType.CustomHeader, this, Debug) .CompressMessage(compress) .EncryptMessage(encrypt) .SetHeaderString(header) .SetMessage(message); builder.Build(); SendToSocket(builder.PayLoad, close, false); }
public void SendMessageContract(IMessageContract contract, bool compress = false, bool encrypt = false, bool close = false) { var builder = new SimpleMessage(MessageType.MessageContract, this, Debug) .CompressMessage(compress) .EncryptMessage(encrypt) .SetHeaderString(contract.MessageHeader) .SetBytes(contract.SerializeToBytes()); builder.Build(); SendToSocket(builder.PayLoad, close, false); }
public void SendBytes(int id, byte[] data, bool compress = false, bool encrypt = false, bool close = false) { var client = GetClient(id); var messageBuilder = new SimpleMessage(MessageType.Bytes, this, Debug) .CompressMessage(compress) .EncryptMessage(encrypt) .SetBytes(data) .SetSendClient(client); messageBuilder.Build(); SendToSocket(messageBuilder.PayLoad, close, false, id); }
public void SendMessage(int id, string message, bool compress = false, bool encrypt = false, bool close = false) { var client = GetClient(id); var messageBuilder = new SimpleMessage(MessageType.Message, this, Debug) .CompressMessage(compress) .EncryptMessage(encrypt) .SetMessage(message) .SetSendClient(client); messageBuilder.Build(); SendToSocket(messageBuilder.PayLoad, close, false, id); }
public void SendMessageWithMetadata(object message, IDictionary <object, object> metadata, bool compress = false, bool encrypt = false, bool close = false) { var builder = new SimpleMessage(MessageType.MessageWithMetadata, this, Debug) .CompressMessage(compress) .EncryptMessage(encrypt) .SetMetadata(metadata) .SetBytes(ObjectSerializer.SerializeObjectToBytes(message)) .SetHeaderString(message.GetType().AssemblyQualifiedName); builder.Build(); SendToSocket(builder.PayLoad, close, false); }
public void SendObject(object obj, bool compress = false, bool encrypt = false, bool close = false) { if (ObjectSerializer == null) { throw new Exception("No ObjectSerializer is currently set."); } var builder = new SimpleMessage(MessageType.Object, this, Debug) .CompressMessage(compress) .EncryptMessage(encrypt) .SetBytes(ObjectSerializer.SerializeObjectToBytes(obj)) .SetHeaderString(obj.GetType().AssemblyQualifiedName); builder.Build(); SendToSocket(builder.PayLoad, close, false); }
protected void SendBasicAuthMessage() { var osVersion = Environment.OSVersion; var guid = string.IsNullOrEmpty(_clientGuid) ? Guid.NewGuid().ToString() : _clientGuid; var msg = guid + "|" + osVersion; var builder = new SimpleMessage(MessageType.BasicAuth, this, Debug) .CompressMessage(false) .EncryptMessage(true) .SetMessage(msg); builder.Build(); //Setting partial to true prevents MessageSubmitted invoke. SendToSocket(builder.PayLoad, false, true); }