jzsues / pomelo-websocket-java-client Goto Github PK
View Code? Open in Web Editor NEWjava websocket lib with protobuf implement for pomelo
License: MIT License
java websocket lib with protobuf implement for pomelo
License: MIT License
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…
I found no logic of receiving broadcast from server, just like the "on" method?
the onData method just handle the reply of the request method.
can u provide jar package on git? maven is hard to use.
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
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 .
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.