stream¶
-
uv.stream.
shutdown
()¶ Shutdown a stream that is connected, disabling the write side. The shutdown callback will be called directly after.
Warning
Ensure that you do not close the stream at the same time that you shutdown. Close after the shutdown callback has been called.
-
uv.stream.
listen
(backlog)¶ Set a
Stream
object to listen.Arguments: - backlog (int) – The number of connections the kernel may queue.
-
uv.stream.
accept
()¶ Accept a new connection on a
Stream
.Returns: An object corresponding to the original type of the Stream
that this function was called on.
-
uv.stream.
read_start
()¶ Start reading from the
Stream
.Throws: If unable to start reading from the Stream (disconnected, etc.)
-
uv.stream.
read_stop
()¶ Stop reading data from the
Stream
.Note
The ‘data’ callback will not be called beyond this point, if new data is recieved.
-
uv.stream.
write
(buffer)¶ Write data to the
Stream
.Arguments: - buffer (Uint8Array) – A Uint8Array containing the raw data you want to write to the
Stream
.
Throws: If unable to write to the
Stream
.- buffer (Uint8Array) – A Uint8Array containing the raw data you want to write to the
-
uv.stream.
on
(event, callback)¶ Set a callback for an event occuring. Possible events are
Event Callback schema data function(len, buffer) connection function(status) write function(status) connect function(status) close function() shutdown function(status) Arguments: - event (string) – A string indicating the event that you want to listen for.
- callback (function) – A function that should be called upon these events occuring.
-
uv.stream.
is_writable
()¶ Returns a value indicating if the
Stream
can be written to.Returns: A boolean indicating if you can write to the Stream
.
-
uv.stream.
is_readable
()¶ Returns a value indicating if the
Stream
can be read from.Returns: A boolean indicating if you can read from the Stream
-
uv.stream.
set_blocking
(enable)¶ Set if the
Stream
should block.Arguments: - enable (bool) – Whether the
Stream
should block or not.
- enable (bool) – Whether the
-
uv.stream.
close
()¶ Close the
Stream
.Note
If you call this while there are pending events, there is a very high likelyhood that the game will crash. Ensure that you shutdown the
Stream
, before closing it.Throws: If unable to close the Stream
.