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

comet 向客户端连接写入消息, protocol.go 文件中 WriteTCP方法,需要判断op == OpRaw, websocket缺不需要 #375

Open
jiayiming001 opened this issue Jun 24, 2021 · 1 comment

Comments

@jiayiming001
Copy link

Websocket
image

Tcp
image

@xFinal
Copy link

xFinal commented Aug 18, 2021

job->push.go->pushKey()里,把op置为OpRaw,并把整个TCP包的内容写入到tcp body里了,相当于tcp包里有两个重复的头。所以WriteTCP这里判断如果op==OpRaw,就直接写body中的内容。

websocket中没做这个处理,但是是clinet.js中做了处理,第68行:
for (var offset=rawHeaderLen; offset<data.byteLength; offset+=packetLen) {
这里的offset一开始就被设置为rawHeaderLen,跳过了第一个头。

这个流程很扯,要用的话自己改下。

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