code: public final void write(byte[] data) {
      if (sendBinary) {
        int prev = 0;
        for (int i = 0;i < data.length;i++) {
          if (data[i] == -1) {
            rawWrite(data, prev, i - prev);
            send(new byte[]{-1, -1});
            prev = i + 1;
          }
        }
        rawWrite(data, prev, data.length - prev);
      } else {
        for (int i = 0;i < data.length;i++) {
          data[i] = (byte)(data[i] & 0x7F);
        }
        send(data);
      }
    }
docs: Write data to the client, escaping data if necessary or truncating it. The original buffer can
  be mutated if incorrect data is provided.
  
  @param data the data to write