ic&nbsp;void&nbsp;setOnerror&#8203;(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;onerror)</pre>
<div class="block"><span class="changed_added_4_0">
 Sets the JavaScript event handler function that is invoked when a connection error has occurred and the websocket
 will attempt to reconnect. The function will be invoked with three arguments: the error reason code, the
 