class

SocketIO::Client

Inherits Reference < Object

Constructors

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

Instance methods

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
Source
close
Source
connect(data = Hash(String, String).new)
Source
disconnect
Source
emit(event_name : String, *data)
Source
emit_with_ack(event_name : String, *data, timeout : Time::Span = 30.seconds)
Source
off(event_name : String, &block : EventHandler)
Source
off(event_name : String)
Source
on(event_name : String, &block : EventHandler)
Source