Module etcd-client.client.jsstream

JSON io interface over httpc io stream.

Instance methods

instance.write (self, data[, timeout]) Write a table to the stream.
instance.read (self[, timeout]) Read a table from the stream.
instance.close (self) Close the io stream.

Module functions

new (io) Create a new JSON io instance.


Instance methods

instance.write (self, data[, timeout])

Write a table to the stream.

Parameters:

  • self

    JSON io instance.

  • data (table)

    A table to encode and send via the JSON stream.

  • timeout (number, optional)

    Maximum waiting time for reading. The default value is 10s.

Returns:

  1. true on success
  2. false, error string on error

Raises:

errors if a param is invalid
instance.read (self[, timeout])

Read a table from the stream.

Parameters:

  • self

    JSON io instance.

  • timeout (number, optional)

    Maximum waiting time for writing. The default value is 10s.

Returns:

  1. true, decoded table on success
  2. false, error string on error

Raises:

errors if a param is invalid
instance.close (self)

Close the io stream.

The call do nothing if the stream is already closed.

Parameters:

  • self

    JSON io instance.

Returns:

    nil

Module functions

new (io)

Create a new JSON io instance.

Parameters:

  • io (table)

    HTTP client input/output stream.

Returns:

    JSON io instance