Class: EventMachine::Breakout::Connection

Inherits:
WebSocket::Connection
  • Object
show all
Defined in:
lib/em-breakout/connection.rb

Direct Known Subclasses

Browser, Worker

Constant Summary collapse

@@connection_counter =
0

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#gridObject (readonly)

public name of worker-browser group



6
7
8
# File 'lib/em-breakout/connection.rb', line 6

def grid
  @grid
end

#grid_nameObject (readonly)

public name of worker-browser group



6
7
8
# File 'lib/em-breakout/connection.rb', line 6

def grid_name
  @grid_name
end

#is_closingObject (readonly)

public name of worker-browser group



6
7
8
# File 'lib/em-breakout/connection.rb', line 6

def is_closing
  @is_closing
end

Instance Method Details

#cidObject



10
11
12
# File 'lib/em-breakout/connection.rb', line 10

def cid
  @cid ||= @@connection_counter += 1
end

#close_websocket(msg = nil) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/em-breakout/connection.rb', line 14

def close_websocket(msg=nil)
  unless @is_closing
    @is_closing = true
    send(msg) if msg
    super()
  end
end

#log(msg) ⇒ Object



22
23
24
# File 'lib/em-breakout/connection.rb', line 22

def log(msg)
  puts "** #{self.class.name.split('::').last} #{cid} ********** \n#{msg}\n\n\n"
end