Skip to content

[QUESTION] What is Endian of Message Length #3

Description

@lykhouzov

Hi, I am trying to repeat the examples but in Rust an faced a little issue that i cannot find following.
In tutorial it is said that message frame structure is following

 +--------------------------+-----------------------------------------+  
 | Message Length (4 bytes) | Serialized ProtoMessage object (byte[]) |  
 +--------------------------+-----------------------------------------+  
                            |<---------- Message Length ------------->|

But i cannot find is method length is Big or Little Endian.
I've tried both variant and both gives me empty response
for example i am sending following message

let msg = ProtoOAGetAccountListByAccessTokenReq{
        payloadType: ProtoOAPayloadType::PROTO_OA_GET_ACCOUNTS_BY_ACCESS_TOKEN_REQ,
        accessToken: Cow::from(ACCESS_TOKEN),
    };

and then i can get a response and decode it but a structure has empty(default) fields

ProtoOAGetAccountListByAccessTokenRes {
    payloadType: PROTO_OA_GET_ACCOUNTS_BY_ACCESS_TOKEN_RES,
    accessToken: "",
    permissionScope: None,
    ctidTraderAccount: [],
}

when I read from stream

let mut length: [u8; 4] = [0x00; 4];
    stream.read_exact(&mut length)?;
    println!("received bytes = {:?}, length = {:?}", length, i32::from_le_bytes(length));

I get following bytes and converted into length

received bytes = [21, 3, 1, 0], length = 66325

that is i am receiving some response, but it looks like it is empty(default) response message

could you help me with this?
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions