class HqTrivia::Connection::Hq

Overview

A connection that connects to the current shows websocket and streams messages to the bot.

Included Modules

Defined in:

hqtrivia/connection/hq.cr

Constructors

Instance Method Summary

Instance methods inherited from module HqTrivia::Connection::Interface

connect(coordinator : Coordinator) connect, on_client_ping(&block : String -> ) on_client_ping, on_message(&block : HqTrivia::Model::WebSocketMessage -> ) on_message, on_raw_message(&block : String -> ) on_raw_message, on_server_pong(&block : String -> ) on_server_pong, open? open?, run run, send_message(message : String) send_message

Constructor Detail

def self.new(raw_messages_only : Bool = false) #

[View source]

Instance Method Detail

def connect(coordinator : Coordinator) #

Connects to the HQ websocket


[View source]
def open? : Bool #

Returns true if the connection is open, false otherwise


[View source]
def ping #

Pings the connection with the optional message


[View source]
def run #

Starts the connection, you must call #connect first


[View source]
def send_message(message : String) #

Sends the message to the connection, raises if the connection is not open


[View source]