Skip to content
徐昊 edited this page Nov 10, 2018 · 5 revisions
  • The OkSocket receiving data need a specific format, and the library provides the interface for modifying the reading protocol. See Receiving Protocol
//...After the parsing header is properly set...
@Override
public void onSocketReadResponse(ConnectionInfo info, String action, OriginalData data) {
    //Follow the above rules, this callback can be normal received the data returned from the server, 
    //the data in the OriginalData, for byte [] array, 
    //the array data already processed byte sequence problem, 
    //can be used in the ByteBuffer directly
}
  • OriginalData The data returned by the server is automatically split into packet headers and payloads.
    • mHeadBytes Package Header
    • mBodyBytes Package Payload