Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server response decode error? #3

Closed
duongxinh2003 opened this issue Oct 29, 2024 · 2 comments
Closed

Server response decode error? #3

duongxinh2003 opened this issue Oct 29, 2024 · 2 comments

Comments

@duongxinh2003
Copy link

When I get response by command 1-1 from server, the expected result like:
jackson, hello, jackson !
But when I decoded from byte array from response server:
[8, 1, 16, 0, 24, 129, 128, 4, 32, 0, 50, 27, 10, 25, 106, 97, 99, 107, 115, 111, 110, 44, 32, 104, 101, 108, 108, 111, 44, 32, 106, 97, 99, 107, 115, 111, 110, 32, 33, 56, 3]
It cannot decode look like response, actual seem add some symbols:

������� 2�
�jackson, hello, jackson !8�

Here is some script to decode this:

const arr = new Uint8Array([8, 1, 16, 0, 24, 129, 128, 4, 32, 0, 50, 27, 10, 25, 106, 97, 99, 107, 115, 111, 110, 44, 32, 104, 101, 108, 108, 111, 44, 32, 106, 97, 99, 107, 115, 111, 110, 32, 33, 56, 3]);
const decoder = new TextDecoder('utf8');
const str = decoder.decode(arr);
console.log(str)
@iohao
Copy link
Owner

iohao commented Oct 29, 2024

Simulate client request data

public class DemoClient {
public static void main(String[] args) {
// 关闭模拟请求相关日志
ClientUserConfigs.closeLog();
// 模拟请求数据
List<InputCommandRegion> inputCommandRegions = List.of(
new DemoRegion()
);
// 启动模拟客户端
new ClientRunOne()
.setInputCommandRegions(inputCommandRegions)
.startup();
}
}

or see iohao/ioGame#312

@duongxinh2003
Copy link
Author

duongxinh2003 commented Oct 30, 2024

I just downloaded the demo of JS client at https://github.com/iohao/ioGameExamples/tree/main/SimpleExample/example/example-codec-json/src/main/resources/WEB-INF/static and ran it. It seems not working.
image
Edit: Sorry for my fault, I don't change the server demo by JsonDataCodec()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants