View Source Antikythera.Test.WebsocketClient (antikythera v0.5.1)

Websocket client for gear tests.

Prepare your client module with:

defmodule YourGear.Socket do
  use Antikythera.Test.WebsocketClient
end

Then, call YourGear.Socket.spawn_link("/ws") to open Websocket connection at "ws(s)://<host_name>/ws" endpoint. It will return pid of Websocket connection handling process if successful.

By default, it connects to the server specified by Antikythera.Test.Config.base_url/0, and redirects received frame to the caller (test running) process, in {frame, handler_pid} form.

These default behavior can be overridable with two overridable functions:

  • base_url/0
  • handle_received_frame/2