class Discord::WebSocket

Overview

Internal wrapper around HTTP::WebSocket to decode the Discord-specific payload format used in the gateway and VWS.

Defined in:

discordcr/websocket.cr

Constant Summary

Log = Discord::Log.for("ws")
ZLIB_SUFFIX = Bytes[0, 0, 255, 255]

Constructors

Instance Method Summary

Constructor Detail

def self.new(host : String, path : String, port : Int32, tls : Bool, zlib_buffer_size : Int32 = (10 * 1024) * 1024) #

[View source]

Instance Method Detail

def close(code : HTTP::WebSocket::CloseCode | Int | Nil = nil, message = nil) #

[View source]
def on_close(&handler : HTTP::WebSocket::CloseCode, String -> ) #

[View source]
def on_compressed(&handler : Packet -> ) #

[View source]
def on_compressed_stream(&handler : Packet -> ) #

[View source]
def on_message(&handler : Packet -> ) #

[View source]
def run #

[View source]
def send(message) #

[View source]