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

How to determine whether the received PACKET is binary or text? #136

Closed
torukskywalker opened this issue Dec 19, 2021 · 1 comment
Closed

Comments

@torukskywalker
Copy link

  1. 如何在客户端及服务端判断收到的PACKET是binary或text ?
  2. C++客户端试着用binary mode传送arraybuffer, 每一次最大似乎不能超过4MB?
  3. C++客户端传送更大数据量时切成每笔4MB, 但每笔似乎要间隔(sleep(1) ),否则会错误.( 服务端会断线再重连)
@ithewei
Copy link
Owner

ithewei commented Dec 19, 2021

你的这些问题是指websocket协议吗,不然我很难对号入座,如果是,请看下面解答:

1、websocket回调里确实没有给出帧类型,因为不提倡通过websocket协议的opcode来区分binary或text,而是应该通过url;
2、3:明显是大数据没做发送流量控制,过快的发会导致内部写队列堆积,当超过一定量,为了避免内存暴涨所以自动close掉了,这点你可以通过查看日志里是否有high water字样(写队列高水位报警)来确认;

建议阅读:

@ithewei ithewei changed the title binary mode传送arraybuffer 的maximum size 及判断收到的PACKET是binary或text? How to determine whether the received PACKET is binary or text? Dec 25, 2021
@ithewei ithewei closed this as completed Jan 1, 2022
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