I can't send msg by wss connect
wyxy2005 opened this issue · comments
I use demo test,but demo can't send msg by wss connect.test address(wss://127.0.0.1:8585)
So long as send a msg ,the server quick close and xcode show msg:
Error Domain=GCDAsyncSocketErrorDomain Code=7 "Socket closed by remote peer" UserInfo={NSLocalizedDescription=Socket closed by remote peer}
I use js is ok. code demo:
<script>
var ws = new WebSocket("wss://127.0.0.1:8585");
var close = false;
// 心跳 10秒一次
ref = setInterval(function() {
ws.send('{"type":"ping"}');
}, 10000);
ws.onopen = function(){
ws.send('{"type":"www"}');
};
ws.onmessage = function(e) {
var json = JSON.parse(e.data);
var type = json.type;
var data = json.data;
console.log(e.data);
};
</script>
... Only set config:
client?.config.maskMessages = true
So it's not a bug!
@wyxy2005 Great, I see you already found the solution!
Telegraph by default only enables WebSocket masks if the messages are passed over an unsecure connection (HTTP). For secure connections the mask is default false.
I would have to check the spec if this is correct.