Exemplo n.º 1
0
        internal async Task SendLogin(string username, string position, string appID = "256", int streamID = 1)
        {
            var loginReq = new ReqMessage
            {
                ID      = streamID, Domain = DomainEnum.Login,
                MsgType = MessageTypeEnum.Request,
                Key     = new MessageKey()
            };

            loginReq.Key.Elements = new Dictionary <string, object> {
                { "ApplicationId", appID }, { "Position", position }
            };
            loginReq.Key.Name = new List <string> {
                username
            };
            Out(loginReq.ToJson());
            await ClientWebSocketUtils.SendTextMessage(_websocket.WebSocket, loginReq.ToJson());
        }
Exemplo n.º 2
0
        internal async Task SendMarketPriceRequest(string itemList, int streamId, bool streamingFlag = true, List <string> fieldList = null)
        {
            var marketPriceReq = new ReqMessage
            {
                ID        = streamId,
                Domain    = DomainEnum.MarketPrice,
                Streaming = streamingFlag,
                Key       = new MessageKey
                {
                    Name     = itemList.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList(),
                    NameType = NameTypeEnum.Ric
                }
            };

            if (fieldList != null)
            {
                marketPriceReq.View = fieldList;
            }
            Out(marketPriceReq.ToJson());
            await ClientWebSocketUtils.SendTextMessage(_websocket.WebSocket, marketPriceReq.ToJson());
        }
 public async Task SendMrnStoryRequest(int streamId, string storyItem = "MRN_STORY")
 {
     var marketPriceReq = new ReqMessage
     {
         ID     = streamId,
         Domain = DomainEnum.NewsTextAnalytics,
         Key    = new MessageKey {
             Name = new List <string> {
                 storyItem
             }, NameType = NameTypeEnum.Ric
         }
     };
     await ClientWebSocketUtils.SendTextMessage(_websocket.WebSocket, marketPriceReq.ToJson());
 }