In Opera 12.10, set binaryType earlier.

Otherwise, the first message received may be blob depending on timing.
This commit is contained in:
Joel Martin 2012-11-14 12:24:08 -05:00
parent 1d795c0643
commit c33f0b52e7
1 changed files with 3 additions and 3 deletions

View File

@ -331,6 +331,9 @@ function open(uri, protocols) {
websocket = {}; websocket = {};
} else { } else {
websocket = new WebSocket(uri, protocols); websocket = new WebSocket(uri, protocols);
if (protocols.indexOf('binary') >= 0) {
websocket.binaryType = 'arraybuffer';
}
} }
websocket.onmessage = recv_message; websocket.onmessage = recv_message;
@ -343,9 +346,6 @@ function open(uri, protocols) {
mode = 'base64'; mode = 'base64';
Util.Error("Server select no sub-protocol!: " + websocket.protocol); Util.Error("Server select no sub-protocol!: " + websocket.protocol);
} }
if (mode === 'binary') {
websocket.binaryType = 'arraybuffer';
}
eventHandlers.open(); eventHandlers.open();
Util.Debug("<< WebSock.onopen"); Util.Debug("<< WebSock.onopen");
}; };