Safari 10.1의 WebSocket API에는 버퍼링 할 수있는 최대 바이너리 데이터가 있고 보낸 다음 메시지에 "WebSocket 연결 ... 실패 : WebSocket 프레임을 보내지 못했습니다."라는 오류 메시지가 표시됩니다.Safari 10.1 오류 "WebSocket 프레임을 보내지 못했습니다"를 해결하는 방법?
Safari는 코드 1006 (CLOSE_ABNORMAL)로 연결을 닫습니다.
WebSocket을은 supposed to report the bufferedAmount
있습니다 -하지만 사파리는 항상 오류가 발생하고 연결이 종료 까지 후 0
보고합니다.
각 메시지 사이에 100ms의 setTimeout을 시도했는데 데이터의 작은 덩어리에서 작동하는 것처럼 보였습니다.하지만 닫는 JSON 메시지를 보내더라도 부서지기 쉬운 큰 덩어리가 계속 표시됩니다. 더 긴 지연.
see the bug in action here - "Play Sample"버튼은 Safari 10.03에서는 작동하지만 10.1에서는 오류가 있습니다. (Code that handles the WebSocket connection.)
이 문제를 해결하는 방법에 대한 아이디어가 있으십니까? 또는 한도는 무엇입니까? 사파리가 오픈 소스라는 것을 알고 있지만 어디서 볼 것인지 잘 모르겠습니다.
업데이트 : 여기에 간단한 예제 :
// this fails in Safari 10.1 but works in 10.03 (and other browsers)
var ws = new WebSocket('wss://echo.websocket.org');
ws.onerror = function(evt) {
// Not sure why, but error events seem to have no useful information
// The console, however, will have the following error:
// WebSocket connection to 'wss://echo.websocket.org/' failed: Failed to send WebSocket frame.
console.log("WebSocket error - see console for message");
}
ws.onclose = function(evt) {
console.log(`WebSocket closed with code: ${evt.code}, reason: ${evt.reason}`);
}
ws.onopen = function() {
console.log('sending first binary message');
ws.send(new Uint8Array(23085));
console.log('bufferedAmount is ' + ws.bufferedAmount);
// this gets the error
console.log('sending second binary message');
ws.send(new Uint8Array(23085));
console.log('bufferedAmount is ' + ws.bufferedAmount);
console.log('sending third binary message');
ws.send(new Uint8Array(23085));
console.log('bufferedAmount is ' + ws.bufferedAmount);
ws.close();
}
https://jsfiddle.net/yta2mjuf/2/
두 번째 메시지는 오류가 연결을 닫습니다, 세 번째 메시지 후, bufferedAmount
내가 노력 23093.
웹킷에 버그를 제출했습니다. https://bugs.webkit.org/show_bug.cgi?id=170463 –
동일한 문제가 발생했습니다. 우리를위한 임계 값은 UInt8Array (23085)의 버퍼 인 것 같습니다. 더 큰 것, 그리고 우리는 같은 오류를 봅니다. (bufferedAmount는 항상 0을보고합니다.) 죄송합니다. 지금은 더 이상 도움이되지 않습니다. 사파리 버그인지 또는 새로운 보안 문제인지는 모르겠습니다. – MikeB
수정을 기다리는 우리 편에서 같은 ... –