Fix web-socket-js: encode sent data across FABridge.
This commit is contained in:
parent
af6b17ce06
commit
d38406e6b5
|
@ -104,14 +104,14 @@ public class WebSocket extends EventDispatcher {
|
|||
public function send(data:String):int {
|
||||
if (readyState == OPEN) {
|
||||
socket.writeByte(0x00);
|
||||
socket.writeUTFBytes(data);
|
||||
socket.writeUTFBytes(decodeURIComponent(data));
|
||||
socket.writeByte(0xff);
|
||||
socket.flush();
|
||||
main.log("sent: " + data);
|
||||
return -1;
|
||||
} else if (readyState == CLOSED) {
|
||||
var bytes:ByteArray = new ByteArray();
|
||||
bytes.writeUTFBytes(data);
|
||||
bytes.writeUTFBytes(decodeURIComponent(data));
|
||||
bufferedAmount += bytes.length; // not sure whether it should include \x00 and \xff
|
||||
// We use return value to let caller know bufferedAmount because we cannot fire
|
||||
// stateChange event here which causes weird error:
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
if (!this.__flash || this.readyState == WebSocket.CONNECTING) {
|
||||
throw "INVALID_STATE_ERR: Web Socket connection has not been established";
|
||||
}
|
||||
var result = this.__flash.send(data);
|
||||
var result = this.__flash.send(encodeURIComponent(data));
|
||||
if (result < 0) { // success
|
||||
return true;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue