W3C home > Mailing lists > Public > public-secondscreen@w3.org > July 2015

Re: [presentation-api] Define behavior when sending a message to a PresentationSession fails

From: Mounir Lamouri via GitHub <sysbot+gh@w3.org>
Date: Thu, 23 Jul 2015 16:56:04 +0000
To: public-secondscreen@w3.org
Message-ID: <issue_comment.created-124166770-1437670563-sysbot+gh@w3.org>
I would be in favour of not automatically close and let the web page 
make that decision.

Regarding promise vs. event, I would prefer using a promise because it
 makes it clearer the error is about the message sending and it allows
 different error handling depending on the ```send()``` call. It also 
prevents us from having to pass back the message that was sent and all
 the issues with the type of the message. It comes with a bit `more 
overhead than the event though.

```js
session.onsenderror = function(e) {
  // Note: e.message? e.data? what should we expect the type to be?
  console.error("Was not able to send message '" + e.message + "'");
};
session.send(msg);
```
vs
```js
session.send(msg).catch(function(e) {
  console.error("Was not able to send message '" + msg + "'");  
});
```

If we go with the event, at least, I think we should not use 
```error``` but ```senderror``` for the event name.

-- 
GitHub Notif of comment by mounirlamouri
See 
https://github.com/w3c/presentation-api/issues/149#issuecomment-124166770
Received on Thursday, 23 July 2015 16:56:06 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 23 July 2015 16:56:07 UTC