encryption – Is it a good idea to send integers instead of strings over SSL to save bandwidth?


I am creating an app with client-server design. The client and server communicate with each other by sending data as binary message (CBOR array) via WebSocket. Instead of sending strings, I have created a dictionary mapped with integers like this:

const DICT: &(&str) = &(
    "USERNAME_NOT_AVAILABLE",
    "USERNAME_AND_PASSWORD_DID_NOT_MATCHED",
    ....blablba long list ....
);

// genrates code like this:-
// pub const USERNAME_AND_PASSWORD_DID_NOT_MATCHED : u16 = 4;
fn gen_rust(version: &String) -> String {
    let mut code = format!(
        "//generated code from Examer server version {}nn",
        version
    );
    for (index, element) in DICT.iter().enumerate() {
        code.push_str(&format!("pub const {} : u16 = {};n", element, index))
    }
    code
} 

The generated dictionary is then shared between client and server and I send integers instead of strings.

This approach does provide benefits like autocompletion and compile time errors if I do spelling mistakes which I do a lot but does this reduce the size of messages when encrypted with SSL? I heard that if the message is too small then padding is added and thus my main goal of reducing the size of the message wont be achieved.