Re: [push-api] Binary messages and use of `USVString` in `PushMessageDataInit` (#159)

> If you get a string it should only be from utf-8 bytes. (Bytes decoded as utf-8, with replacement as error handling mode.)

Should we decode when creating the `PushMessageData` object, though, or only when `text()` is called? I'm guessing the latter, since we expose `blob()` and `arrayBuffer()`, and UTF-8 decoding will garble binary messages. Section 11.1 seems to imply this:

> * Let `event` be a new `PushEvent`, whose data attribute is a new `PushMessageData` with `bytes` set to the binary message data received by the user agent in the push message, or an empty byte sequence if no data was received.

So `bytes` is a byte sequence, but `PushMessageDataInit` is a `USVString`. Would it make sense to have something like this instead?

```webidl
typedef sequence<octet> PushMessageDataInit;
```

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/push-api/issues/159#issuecomment-133295530

Received on Friday, 21 August 2015 05:46:27 UTC