问题描述
- WebSocket服务端发消息给客户端,浏览器收到消息就关闭了
-
自己按照 Websocket 的 文档写的, 浏览器每次连接上, 一收到消息就断开了
报错:WebSocket connection to 'ws://192.168.1.248:2051/' failed: A server must not mask any frames that it sends to the client.
但是 内容根本就没有mask
然后连网上别的websocket服务器,连上发消息正常, 然后直接对消息抓包 过来原文发送,还是包这个错误;
wireshark 都能识别,但是 浏览器就是一收到就报错断开,,,快崩溃了了~~~~下面是发送的数据:
char tt[250]={0x81,0x53,0x7b,0x22,0x6a,0x73,0x6f,0x6e,0x72,0x70
,0x63,0x22,0x3a,0x22,0x32,0x2e,0x30,0x22,0x2c,0x22,0x65,0x72,0x72,0x6f,0x72,0x22
,0x3a,0x7b,0x22,0x63,0x6f,0x64,0x65,0x22,0x3a,0x2d,0x31,0x30,0x30,0x30,0x30,0x32
,0x2c,0x22,0x6d,0x65,0x73,0x73,0x61,0x67,0x65,0x22,0x3a,0x22,0x54,0x65,0x73,0x74
,0x5f,0x56,0x61,0x6c,0x75,0x65,0x20,0x69,0x73,0x20,0x6e,0x6f,0x74,0x20,0x76,0x61
,0x6c,0x69,0x64,0x20,0x6a,0x73,0x6f,0x6e,0x22,0x7d,0x7d,0};
解决方案
收到就报错断开,,,快崩溃了了
解决方案二:
怀疑是发送的数据问题,换一个其他简单的数据试试。
解决方案三:
就没有人 遇到过???
解决方案四:
mask指的是掩码,客户端向服务器发送数据可以有掩码也可以没有掩码,但是服务器向客户端发数据必须不带掩码。
解决方案五:
俺遇到了 还没解决不知道怎么解决
解决方案六:
俺遇到了 还没解决不知道怎么解决
时间: 2024-12-05 17:13:47