enum abstract SocketEvent<T>(Event<T>)
package js.node.net
to Event<T>
import js.node.net.Socket
Enumeration of events for Socket
objects.
Variables
inlineread onlyClose:SocketEvent<Bool ‑> Void> = "close"
Emitted once the socket is fully closed.
The argument had_error
is a boolean which says if the socket was closed due to a transmission error.
Listener arguments:
had_error - true if the socket had a transmission error
inlineread onlyConnect:SocketEvent<() ‑> Void> = "connect"
Emitted when a socket connection is successfully established. See Socket.connect
.
inlineread onlyData:SocketEvent<EitherType<Buffer, String> ‑> Void> = "data"
Emitted when data is received.
The argument data will be a Buffer
or String
.
Encoding of data is set by Socket.setEncoding
.
Note that the data will be lost if there is no listener when a Socket emits a 'data' event.
inlineread onlyDrain:SocketEvent<() ‑> Void> = "drain"
Emitted when the write buffer becomes empty. Can be used to throttle uploads.
See also: the return values of Socket.write
inlineread onlyEnd:SocketEvent<() ‑> Void> = "end"
Emitted when the other end of the socket sends a FIN packet.
By default (allowHalfOpen == false) the socket will destroy its file descriptor once
it has written out its pending write queue. However, by setting allowHalfOpen == true
the socket will not automatically end
its side allowing the user to write arbitrary amounts of data,
with the caveat that the user is required to end
their side now.
inlineread onlyError:SocketEvent<Error ‑> Void> = "error"
Emitted when an error occurs. The 'close' event will be called directly following this event.
inlineread onlyLookup:SocketEvent<(Null<Error>, String, DnsAddressFamily) ‑> Void> = "lookup"
Emitted after resolving the hostname but before connecting. Not applicable to UNIX sockets.
inlineread onlyTimeout:SocketEvent<() ‑> Void> = "timeout"
Emitted if the socket times out from inactivity.
This is only to notify that the socket has been idle
The user must manually close the connection.
See also: Socket.setTimeout