mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
27 lines
667 B
JavaScript
27 lines
667 B
JavaScript
const expect = require("expect.js");
|
|
const eio = require("../");
|
|
|
|
describe("binary fallback", function () {
|
|
this.timeout(10000);
|
|
|
|
it("should be able to receive binary data when ArrayBuffer not available (polling)", (done) => {
|
|
const socket = new eio.Socket({ forceBase64: true });
|
|
socket.on("open", () => {
|
|
socket.send("give binary");
|
|
let firstPacket = true;
|
|
socket.on("message", (data) => {
|
|
if (firstPacket) {
|
|
firstPacket = false;
|
|
return;
|
|
}
|
|
|
|
expect(data.base64).to.be(true);
|
|
expect(data.data).to.equal("AAECAwQ=");
|
|
|
|
socket.close();
|
|
done();
|
|
});
|
|
});
|
|
});
|
|
});
|