Class: Cybertrain::Test::WsStep

Inherits:
Object
  • Object
show all
Defined in:
cybertrain/test/websocket_receiver.rb

Overview

One step of a connection’s script: a kind and its data.

  • “accept”: the 101 answer with the right Sec-WebSocket-Accept.
  • “reply_raw”: data as the answer, as it is ({accept} in it is replaced by the right Sec-WebSocket-Accept): a wrong Accept, a 200.
  • “send_with_101”: the 101 and a text frame carrying data, in one write.
  • “send_text” / “send_binary”: one frame carrying data.
  • “send_raw”: data’s bytes, as they are (a protocol violation).
  • “split_frame”: a text frame carrying data, its header first and the payload 1 s later.
  • “expect”: reads one frame from the client and records it.
  • “echo_until_close”: records each frame; sends data frames back, answers a ping with a pong and a close with a close, then ends.
  • “silent”: does nothing for data seconds (“3”).
  • “close”: sends a close with the code in data (“1001”), then reads and records the client’s answer.
  • “drop”: closes the connection without a close frame.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind, data = "") ⇒ WsStep

Returns a new instance of WsStep.

Parameters:

  • kind (String)
  • data (String) (defaults to: "")


46
47
48
49
# File 'cybertrain/test/websocket_receiver.rb', line 46

def initialize(kind, data = "")
  @step_kind = kind.to_s
  @step_data = data.to_s
end

Instance Attribute Details

#step_data ⇒ String (readonly)

Returns:

  • (String)


41
42
43
# File 'cybertrain/test/websocket_receiver.rb', line 41

def step_data
  @step_data
end

#step_kind ⇒ String (readonly)

Returns:

  • (String)


38
39
40
# File 'cybertrain/test/websocket_receiver.rb', line 38

def step_kind
  @step_kind
end