private void WsSourceOnMessageEvent(WsMessageType msgType, string message) { switch (msgType) { case WsMessageType.Opened: OnConnectEvent(); StartPingAliveLogic(); StartPortfolioRequester(); break; case WsMessageType.Closed: OnDisconnectEvent(); break; case WsMessageType.StringData: _queueMessagesReceivedFromExchange.Enqueue(message); break; case WsMessageType.Error: SendLogMessage(message, LogMessageType.Error); break; default: throw new NotSupportedException(message); } }
private void WsSourceOnMessageEvent(WsMessageType msgType, string data) { switch (msgType) { case WsMessageType.Opened: OnConnectEvent(); GetSecuritiesInfo(); StartOrderSender(); StartPortfolioRequester(); break; case WsMessageType.Closed: OnDisconnectEvent(); break; case WsMessageType.StringData: _queueMessagesReceivedFromExchange.Enqueue(data); break; case WsMessageType.Error: SendLogMessage(data, LogMessageType.Error); break; default: throw new NotSupportedException(data); } }
private void WsSourceOnMessageEvent(WsMessageType message_type, string message) { switch (message_type) { case WsMessageType.Opened: SendLoginMessage(); OnConnectEvent(); StartPortfolioRequester(); break; case WsMessageType.Closed: OnDisconnectEvent(); break; case WsMessageType.StringData: queue_messages_received_from_fxchange.Enqueue(message); break; case WsMessageType.Error: SendLogMessage(message, LogMessageType.Error); break; default: throw new NotSupportedException(message); } }
public void SendMessage <T>(WsMessageType type, T obj) { var wsMessage = new WsMessage(); wsMessage.Type = type; wsMessage.From = "Server"; wsMessage.Message = JsonConvert.SerializeObject(obj); var send = JsonConvert.SerializeObject(wsMessage); Server.MulticastText(send); }
private void WsSourceOnByteDataEvent(WsMessageType msgType, byte[] data) { switch (msgType) { case WsMessageType.ByteData: string message = GZipDecompresser.Decompress(data); _queueMessagesReceivedFromExchange.Enqueue(message); break; default: throw new NotSupportedException(data.ToString()); } }
/// <summary> /// Implements the IWsServiceEndpoint.ProcessRequest method. /// Gets a service operation based on the action property sent in the soap header and calls /// invoke on the service method. /// </summary> /// <param name="header">A WsWsaHeader containing the header proerties of a request.</param> /// <param name="envelope">A WsXmlDocument containing the entire envelope of the message in a node tree.</param> /// <returns>A byte array containing a soap response to the request.</returns> private byte[] ProcessRequest(WsWsaHeader header, XmlReader reader) { String action = header.Action; // Display the action name. System.Ext.Console.Write("Action: " + action); // Look for a valid service Action WsServiceOperation operation = m_serviceOperations[action]; if (operation != null) { m_messageType = WsMessageType.Soap; System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(operation.MethodName); if (methodInfo == null) { System.Ext.Console.Write(""); System.Ext.Console.Write("Operation method for action " + header.Action + " was not found"); System.Ext.Console.Write(""); throw new WsFaultException(header, WsFaultType.WsaDestinationUnreachable); } return (byte[])methodInfo.Invoke(this, new object[] { header, reader }); } // Else look for event subscription Action if (action.IndexOf(WsWellKnownUri.WseNamespaceUri) == 0) { action = action.Substring(47/*WsWellKnownUri.WseNamespaceUri.Length + 1*/); switch (action) { case "Subscribe": return Subscribe(header, reader); case "Unsubscribe": return Unsubscribe(header, reader); case "GetStatus": return GetStatus(header, reader); case "Renew": return Renew(header, reader); } } // If a valid Action is not found, fault throw new WsFaultException(header, WsFaultType.WsaDestinationUnreachable, "To: " + header.To + " Action: " + action); }
// Implements the IWsServiceEndpoint.ProcessRequest method. // Gets a service callback method based on the action property sent in a soap header and calls // invoke on the callback method. private byte[] ProcessRequest(WsWsaHeader header, XmlReader reader) { WsServiceOperation callback; // Look for a client event sink callback action if ((callback = m_eventCallbacks[header.Action]) != null) { m_messageType = WsMessageType.Soap; System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(callback.MethodName); if (methodInfo == null) { System.Ext.Console.Write(""); System.Ext.Console.Write("Client event callback method for action " + header.Action + " was not found"); System.Ext.Console.Write(""); } return((byte[])methodInfo.Invoke(this, new object[] { header, reader })); } // If a valid Action is not found, fault throw new WsFaultException(header, WsFaultType.WsaDestinationUnreachable, "To: " + header.To + " Action: " + header.Action); }
private void MarketDataSourceOnMessageEvent(WsMessageType msgType, byte[] data) { switch (msgType) { case WsMessageType.Opened: break; case WsMessageType.Closed: OnDisconnectEvent(); break; case WsMessageType.ByteData: string message = GZipDecompresser.Decompress(data); _queueMarketDataReceivedFromExchange.Enqueue(message); break; case WsMessageType.Error: break; default: throw new NotSupportedException(""); } }
// Implements the IWsServiceEndpoint.ProcessRequest method. // Gets a service callback method based on the action property sent in a soap header and calls // invoke on the callback method. private byte[] ProcessRequest(WsWsaHeader header, XmlReader reader) { WsServiceOperation callback; // Look for a client event sink callback action if ((callback = m_eventCallbacks[header.Action]) != null) { m_messageType = WsMessageType.Soap; System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(callback.MethodName); if (methodInfo == null) { System.Ext.Console.Write(""); System.Ext.Console.Write("Client event callback method for action " + header.Action + " was not found"); System.Ext.Console.Write(""); } return (byte[])methodInfo.Invoke(this, new object[] { header, reader }); } // If a valid Action is not found, fault throw new WsFaultException(header, WsFaultType.WsaDestinationUnreachable, "To: " + header.To + " Action: " + header.Action); }
private static string EncdoeMessage(string even, WsMessageType type, string data) { return($"{MESSAGE_PREFIX}{even}{MESSAGE_SEPARATOR}{type}{MESSAGE_SEPARATOR}{data}"); }