question

Upvotes
Accepted
1 1 1 3

Incomplete message on RDP

Hi,

I have this code.

private void ReceiveMessage()

{

var readBuffer = new ArraySegment<byte>(new byte[BUFFER_SIZE]);

MemoryStream memoryStream = null;

byte[] dataBuffer = null;


while (true)

{

var result = WebSocket.ReceiveAsync(readBuffer, Cts.Token);

if (result.IsFaulted)

{

Disconnect();

}

else

{

if (!result.Result.EndOfMessage)

{

if (memoryStream == null)

memoryStream = new MemoryStream(BUFFER_SIZE * 5);


memoryStream.Write(readBuffer.Array, readBuffer.Offset, readBuffer.Count);

readBuffer = new ArraySegment<byte>(new byte[BUFFER_SIZE]);

}

else

{

if (memoryStream != null)

{

memoryStream.Write(readBuffer.Array, readBuffer.Offset, readBuffer.Count);

dataBuffer = memoryStream.GetBuffer();

memoryStream.Dispose();

}

else

{

dataBuffer = readBuffer.Array;

}

break;

}

}

}


/* Received message(s). */

try

{

JArray messages = JArray.Parse(Encoding.ASCII.GetString(dataBuffer));

/* Print the message (format the object string for easier reading). */

Print("RECEIVED on {0}:\n{1}\n", Name, JsonConvert.SerializeObject(messages, Formatting.Indented));

for (int index = 0; index < messages.Count; ++index)

ProcessJsonMsg(messages[index]);

}

catch (Exception ex)

{

Print("Parsing message got error {0}", ex.Message);

Print(" \t error content = {0} ", Encoding.ASCII.GetString(dataBuffer));

}

}

But I still have incomplete message from RPD. Here is the error.


10/08/2021 22:15:18.654 | Parsing message got error After parsing a value an unexpected character was encountered: 9. Path '[0].Fields.WEEK_LOW', line 1, position 8192.

10/08/2021 22:15:18.654 | error content = [{"ID":13,"Type":"Refresh",

"Key":{"Service":"ELEKTRON_DD","Name":"AUDCAD="},"State":{"Stream":"Open","Data":"Ok"},

"Qos":{"Timeliness":"Realtime","Rate":"JitConflated"},"PermData":"AwEBUmw=",

"SeqNumber":26014,"Fields":{"PROD_PERM":526,"RDNDISPLAY":153,"DSPLY_NAME":"ALFA-BANK MOW",

"TIMACT":"05:15:00","NETCHNG_1":-0.0001,"HIGH_1":0.9202,"LOW_1":0.9190,"CURRENCY":"CAD",

"ACTIV_DATE":"2021-08-11","OPEN_PRC":0.9194,"HST_CLOSE":0.9198,"BID":0.9197,"BID_1":0.9197,

"BID_2":0.9197,"ASK":0.9199,"ASK_1":0.9198,"ASK_2":0.9198,"ACVOL_1":3717,"TRD_UNITS":"4DP ",

"PCTCHNG":-0.01,"OPEN_BID":0.9194,"OPEN_ASK":0.9201,"CLOSE_BID":0.9198,"CLOSE_ASK":0.9203,

"NUM_MOVES":9630,"OFFCL_CODE":"ALFN ","HSTCLSDATE":"2021-08-10","YRHIGH":0.9993,"YRLOW":0.9147,

"BCKGRNDPAG":"ALFH","BID_NET_CH":-0.0001,"BID_TICK_1":"???","MID_PRICE":0.9198,"MID_NET_CH":-0.0003,

"MID_CLOSE":0.9201,"HIGHTP_1":"B","LOWTP_1":"A","BID_HIGH_1":0.9202,"BID_LOW_1":0.9183,

"YRBIDHIGH":0.9993,"YRBIDLOW":0.9146,"HST_CLSBID":0.9198,"HSTCLBDDAT":"2021-08-10",

"NUM_BIDS":3717,"RECORDTYPE":209,"ACT_TP_1":"B???","ACT_TP_2":"B???","ACT_TP_3":"B???",

"SEC_ACT_1":0.9199,"SEC_ACT_2":0.9198,"SEC_ACT_3":0.9198,"SC_ACT_TP1":" A","SC_ACT_TP2":" A",

"SC_ACT_TP3":" A","OPEN_TIME":"21:13:00","HIGH_TIME":"21:17:00","LOW_TIME":"01:15:00",

"YRHIGHDAT":"2021-02-25","YRLOWDAT":"2021-07-30","IRGPRC":-0.01,"TIMCOR":"01:15:03",

"PRIMACT_1":0.9197,"PRIMACT_2":0.9197,"PRIMACT_3":0.9197,"BASE_CCY":"AUD","BCAST_REF":" ",

"CROSS_SC":"1E+00","DLG_CODE1":"ALFN ","DLG_CODE2":"ALFN ","DLG_CODE3":"ALFN ",

"CTBTR_1":"ALFA-BANK ","CTBTR_2":"ALFA-BANK ","CTBTR_3":"ALFA-BANK ","CTB_LOC1":"MOW",

"CTB_LOC2":"MOW","CTB_LOC3":"MOW","CTB_PAGE1":"ALFH","CTB_PAGE2":"ALFH","CTB_PAGE3":"ALFH",

"VALUE_DT1":"2021-08-11","VALUE_DT2":"2021-08-11","VALUE_DT3":"2021-08-11","SEC_HIGH":0.9211,

"SEC_HI_TP":"A","SEC_LOW":0.9190,"SEC_LO_TP":"B","OPEN_TYPE":"B ","CLOSE_TYPE":"B ",

"BKGD_REF":"Aus$/Can$","GEN_TEXT16":" ","GEN_VAL3":0.9201,"GEN_VAL4":null,"GV1_TEXT":"CROSS ",

"GV2_TEXT":"AUDCAD","GV4_TEXT":"SPOT","VALUE_TS1":"05:15:17","VALUE_TS2":"05:15:06","VALUE_TS3":"05:14:56",

"QUOTIM":"05:15:17","GEN_VAL5":0.9217,"GEN_VAL6":0.9237,"GEN_VAL7":0.9196,"GEN_VAL8":0.9238,"GEN_VAL9":0.9197,

"GEN_VAL10":0.9226,"GV5_TEXT":"OP_BID","GV6_TEXT":"BID_HI","GV7_TEXT":"BID_LO","GV8_TEXT":"ASK_HI","GV9_TEXT":

"ASK_LO","GV10_TEXT":"OP_ASK","GN_TXT16_2":" ","GV1_TIME":null,"PREF_DISP":6206,"GN_TXT24_1":" ",

"DSO_ID":16416,"RDN_EXCHD2":"NY$","PREV_DISP":60,"ASIA_CL_DT":"2021-08-10","ASIA_CLOSE":0.9212,"ASIA_HI_TM":"21:17:00","ASIA_HIGH":0.9202,

"ASIA_LOW":0.9190,"ASIA_LW_TM":"01:15:00","ASIA_NETCH":-0.0015,"ASIA_OP_TM":"21:13:00","ASIA_OPEN":0.9194,"EURO_CL_DT":"2021-08-10",

"EURO_CLOSE":0.9204,"EURO_HI_TM":"05:14:00","EURO_HIGH":0.9198,"EURO_LOW":0.9196,"EURO_LW_TM":"05:00:00","EURO_NETCH":-0.0007,

"EURO_OP_TM":"05:00:00","EURO_OPEN":0.9188,"US_CL_DT":"2021-08-10","US_CLOSE":0.9198,"US_HI_TM":"12:24:00","US_HIGH":0.9237,

"US_LOW":0.9197,"US_LW_TM":"14:58:00","US_NETCH":-0.0020,"US_OP_TM":"11:00:00","US_OPEN":0.9227,"ASK_SPREAD":0.9183,"BID_SPREAD":0.9188,

"MID_SPREAD":0.9196,"MONTH_HIGH":0.9311,"MONTH_LOW":0.9153,"PCTCHG_3M":-3.05,"PCTCHG_6M":-6.62,"PCTCHG_MTD":0.44,"PCTCHG_YTD":-6.11,

"QUOTE_DATE":"2021-08-11","WEEK_HIGH":0.9244,"WEEK_LOW":0.


I had never received this error until 2 - 3 weeks ago when Refinitiv had tried to add more services. Do you have any clue to solve this problem?


Regards,

rdp-apirefinitiv-data-platformwebsockets
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello @hasanderonn

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?


If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,


AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.


Thanks,

AHS

1 Answer

· Write an Answer
Upvotes
Accepted
25.3k 87 12 25

Hi @hasanderonn

Are you able to recreate this scenario using one of our existing C# examples for Websocket API?

I just tried requesting AUDCAD= using websocket-api/MarketPriceRdpGwServiceDiscoveryExample.cs at master · Refinitiv/websocket-api (github.com) and I received the response without any error?

audcad.txt


audcad.txt (14.0 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.