This article is in need of a technical review.
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
onerror property is used to specify an event handler to receive
error events. Those events are triggered each time an error occurs.
Note: If an error occurs before the connection has been opened, the error was connection refused,
close event will not be triggered. If an error occurs after the connection has been opened, the connection was lost, and the
close event will be triggered after the
instanceOfTCPSocket.onerror = funcRef
funcRef is a function to be called when the
error event occurs.
This callback function will get a TCPSocketEvent object as its first parameter.
TCPSocketobject which fired the event.
A string defining the type of the event. Its value can be one of the following:
- The data related to the event, if any.
In case of error, the
data property is a string containing the description of the error.