Singyeong.Client (singyeong v0.4.14) View Source

Link to this section Summary

Functions

Send a message with the given payload to all clients matching the given routing query.

Send a message with the given payload to all clients matching the given routing query, sending the given nonce to allow request-response messaging.

Returns a specification to start this module under a supervisor.

Proxies the given HTTP request with the given body to a target matching the given routing query, using the HTTP method provided.

ACK a message from the given queue, letting the server know that it doesn't need to be requeued.

Push the specified message to the specified queue, with a routing query to determine what client can pull it from the queue.

Push the specified message to the specified queue, with a routing query to determine what client can pull it from the queue, sending the given nonce to allow request-response messaging.

Mark this client as being ready to process a message from the given queue.

Send a message with the given payload to a single client matching the given routing query.

Send a message with the given payload to a single client matching the given routing query, sending the given nonce to allow request-response messaging.

Update the client's metadata. A metadata update has a few parts

Link to this section Types

Specs

http_method() :: :get | :post | :put | :patch | :delete

Link to this section Functions

Link to this function

broadcast_msg(query, payload)

View Source

Specs

broadcast_msg(Singyeong.Query.t(), term()) :: :ok

Send a message with the given payload to all clients matching the given routing query.

Link to this function

broadcast_msg(nonce, query, payload)

View Source

Specs

broadcast_msg(String.t() | nil, Singyeong.Query.t(), term()) :: :ok

Send a message with the given payload to all clients matching the given routing query, sending the given nonce to allow request-response messaging.

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

proxy(query, route, method, body \\ nil)

View Source

Specs

Proxies the given HTTP request with the given body to a target matching the given routing query, using the HTTP method provided.

Specs

queue_ack(String.t(), String.t()) :: :ok

ACK a message from the given queue, letting the server know that it doesn't need to be requeued.

Link to this function

queue_msg(queue, query, payload)

View Source

Specs

queue_msg(String.t(), Singyeong.Query.t(), term()) :: :ok

Push the specified message to the specified queue, with a routing query to determine what client can pull it from the queue.

Link to this function

queue_msg(queue, nonce, query, payload)

View Source

Specs

queue_msg(String.t(), String.t() | nil, Singyeong.Query.t(), term()) :: :ok

Push the specified message to the specified queue, with a routing query to determine what client can pull it from the queue, sending the given nonce to allow request-response messaging.

Specs

queue_request(String.t()) :: :ok

Mark this client as being ready to process a message from the given queue.

Link to this function

send_msg(query, payload)

View Source

Specs

send_msg(Singyeong.Query.t(), term()) :: :ok

Send a message with the given payload to a single client matching the given routing query.

Link to this function

send_msg(nonce, query, payload)

View Source

Specs

send_msg(String.t() | nil, Singyeong.Query.t(), term()) :: :ok

Send a message with the given payload to a single client matching the given routing query, sending the given nonce to allow request-response messaging.

Link to this function

terminate(info, ws, state)

View Source
Link to this function

update_metadata(metadata)

View Source

Specs

update_metadata(Singyeong.Metadata.t()) :: :ok

Update the client's metadata. A metadata update has a few parts:

  • key
  • type
  • value

Possible types are:

  • string
  • integer
  • float
  • version
  • list

A metadata update looks like:

%{
  key: %{
    type: "string",
    value: "potato",
  },
  users: %{
    type: "list",
    value: [123, 456, 789],
  }
  version: %{
    type: "version",
    value: "2.0.0",
  }
}