Protocols/MSNP/Activities/SDK/Techref/Objectmodel/Objects/Channel/Events/OnDataError: Difference between revisions
Jump to navigation
Jump to search
Animadoria (talk | contribs) (Created automatically by Anima Importer) |
Animadoria (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
<!-- Generated @ 08/12/2022 23: | <!-- Generated @ 08/12/2022 23:45:53 +01:00 using Anima's CHM converter based on techref/objectmodel/objects/channel/events/OnDataError.htm --> | ||
{{Protocols/MSNP|section=Activities}} | {{Protocols/MSNP|section=Activities}} | ||
__NOTOC__= | __NOTOC__ | ||
= [[Protocols/MSNP/Activities/SDK/Techref/Objectmodel/Objects/Channel/Index|Channel]].OnDataError Event = | |||
Fires when a <span class="clsEvent">SendData</span> operation was not successful. | Fires when a <span class="clsEvent">SendData</span> operation was not successful. | ||
VBScript Syntax | === VBScript Syntax === | ||
<div class="clsCodeStd"> | <div class="clsCodeStd"> | ||
Line 12: | Line 13: | ||
<pre class="clsCode">function Channel_OnDataError() | <pre class="clsCode">function Channel_OnDataError() | ||
' Error during SendData, may need to retry. | ' Error during SendData, may need to retry. | ||
End Function | End Function</pre> | ||
</div> | </div> | ||
JavaScript Syntax | === JavaScript Syntax === | ||
<div class="clsCodeStd"> | <div class="clsCodeStd"> | ||
Line 22: | Line 22: | ||
<pre class="clsCode">function Channel_OnDataError() { | <pre class="clsCode">function Channel_OnDataError() { | ||
// Error during SendData, may need to retry. | // Error during SendData, may need to retry. | ||
} | }</pre> | ||
</div> | </div> | ||
JavaScript Example | |||
=== JavaScript Example === | |||
<div class="clsCodeStd"> | <div class="clsCodeStd"> | ||
Line 62: | Line 62: | ||
</div> | </div> | ||
Remarks | |||
=== Remarks === | |||
Limit the number of retries attempted when <span class="clsEvent">OnDataError</span> occurs, to decrease the chance of receiving data out of order. | Limit the number of retries attempted when <span class="clsEvent">OnDataError</span> occurs, to decrease the chance of receiving data out of order. |
Latest revision as of 00:45, 13 August 2022
Channel.OnDataError Event
Fires when a SendData operation was not successful.
VBScript Syntax
function Channel_OnDataError() ' Error during SendData, may need to retry. End Function
JavaScript Syntax
function Channel_OnDataError() { // Error during SendData, may need to retry. }
JavaScript Example
<script language="JavaScript"> int giDataErrors = 0; function Channel_OnDataError() { // Error during SendData, retry up to three times, // five seconds between each retry, and then call it quits. // Any retries could lead to data being received out of order, // so check for this in your OnDataReceived. if (giDataError >= 3) { setGameOver(); } else { giDataErrors++; myData = window.external.Channel.Error.Data; window.setTimeout("SafeSendData(" + myData + ")",5000); } } function SafeSendData(toSend) { // SafeSendData is SendData with an error handler. try { window.external.Channel.SendData(toSend); } catch (ex) { // Optional debugging output } }
Remarks
Limit the number of retries attempted when OnDataError occurs, to decrease the chance of receiving data out of order.