Git Product home page Git Product logo

pomelo-websocket-java-client's Issues

there is sth wrong with data length of handshake

when handshake return data back to the function PomeloPackage->public static Package decode(byte[] buffer)

buffer's length is 56133 bytes, first 10 byte is:
1, 0, -37, 65, 123, 34, 99, 111, 100, 101
but in this function I get result length=-9407, actually, data is back and useful, why I get the wrong result ?
seens in my case data length is 4bytes? please check the attacthment for detail.

and another issue is function PomeloClient->private void initData(JSONObject data) throws JSONException
line 312 like this:
this.protosVersion = (this.protos.has("version") ? this.protos.getInt("version") : 0);

in my case, version's value is "PjbxDUhHP9BfncghsFUXLg==", it is not an int type,and throw a ClasscastException, I have turn the protosVersion to be a String

look forward to your reply, thank you so much.
Uploading handshakedata.txt…

encode bug

there is a bug, please check it.
byte[] encode = PomeloPackage.encode(PomeloPackage.TYPE_DATA, bytes);
in the function encode:
public static byte[] encode(int type, byte[] body) {
int length = body != null ? body.length : 0;
byte[] buffer = new byte[PKG_HEAD_BYTES + length];
int index = 0;
buffer[index++] = (byte) (type);
buffer[index++] = (byte) ((length >> 16));
buffer[index++] = (byte) ((length >> 8));
buffer[index++] = (byte) (length);
if (body != null) {
for (byte i = 0; i < body.length; i++) {
buffer[PKG_HEAD_BYTES + i] = (byte) body[i];
}
}
return buffer;
}

body.length is bigger then 128, in for(...),i is a byte type ,so there is a Exception :java.lang.ArrayIndexOutOfBoundsException: -128

about encode/decode int32/uint32.

for instance:
int 200,where the server encode as 2 bytes: 144 and 3.
and in this client, it just get only one byte to process.
so i can not decode the data using protobuf, i just don't know how to do with it .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.