Skip to content

Channel

abstract class Azu::Channel
inherits Reference

A channel encapsulates a logical unit of work similar to an Endpoint.

Channels are used for websocket connections that can handle multiple connections instances. A single client may have multiple WebSockets connections open to the application.

Each channel can in turn broadcast to multiple connected clients

You must setup a websocket route in your routing service

ExampleApp.router do
  ws "/hi", ExampleApp::ExampleChannel
end

Direct known subclasses

Azu::Spark

Class methods

.new(socket : HTTP::WebSocket)

View source

Methods

#call(context : HTTP::Server::Context)

View source

abstract #on_binary(binary)

View source

abstract #on_close(code : HTTP::WebSocket::CloseCode | Int? = nil, message = nil)

View source

abstract #on_connect

View source

abstract #on_message(message)

View source

abstract #on_ping(message)

View source

abstract #on_pong(message)

View source

#socket : HTTP::WebSocket

View source

#socket? : HTTP::WebSocket?

View source