Might that not be sending a command to the device and read the reply ?
So what Device / protocol do you use ?
For instance for devices that use the Watch protocol a command can be send to the device as: ts
The reply would be something like this including imei.
ver:R36_SZ6_V1.0_2020.03.20_16.24.13_cob_h;
ID:2495356012;
imei:821648041705163;
ip_url:ip;
port:5093;
upload:600S;
bat level:83;
language:0;
zone:0.00;
NET:OK(100);
guide me how to get websocket send data with imei