class SocketIO::Client

Defined in:

socket_io/socket_io.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(host : String, path : String = "/socket.io/", namespace : String = "/", base64 : Bool = false, decoder : Decoder = Decoders::BaseDecoder.new) #

[View source]

Instance Method Detail

def ack(*data, id : UInt64) #

TODO should we consider replacing the Event class and this public method with a simpler callback approach?

-socket.on("request") do |event|
+socket.on("request") do |data, callback|
  # ...
-  event.ack({
+  callback.call({
    # ...
  })
end

[View source]
def close #

[View source]
def connect(data = Hash(String, String).new) #

[View source]
def disconnect #

[View source]
def emit(event_name : String, *data) #

[View source]
def emit_with_ack(event_name : String, *data, timeout : Time::Span = 30.seconds) #

[View source]
def off(event_name : String, &block : EventHandler) #

[View source]
def off(event_name : String) #

[View source]
def on(event_name : String, &block : EventHandler) #

[View source]