class
Amber::Testing::TestWebSocket
- Amber::Testing::TestWebSocket
- Reference
- Object
Overview
Wraps a WebSocket connection for use in tests. Tracks sent and received messages and provides a simple interface for interacting with WebSocket channels.
Defined in:
amber/testing/websocket_helpers.crConstructors
Instance Method Summary
-
#close
Close the WebSocket connection and shut down the test server.
- #is_closed? : Bool
-
#list_of_received_messages : Array(String)
Messages received from the server.
-
#list_of_sent_messages : Array(String)
Messages sent by the test.
-
#receive : String | Nil
Return the most recently received message, or nil if none.
-
#send(message : String)
Send a message string through the WebSocket.
-
#send_json(event : String, topic : String, payload = {} of String => String)
Send a JSON-structured message through the WebSocket.
Constructor Detail
Instance Method Detail
Return the most recently received message, or nil if none.
Send a JSON-structured message through the WebSocket.