Class: WebSocket::IdleHandler

Inherits:
IdleStateUserEventHandler show all
Defined in:
lib/websocket/idle_handler.rb

Overview

The IdleHandler class handles idle channels detected by the server pipeline.

Instance Method Summary collapse

Methods inherited from IdleStateUserEventHandler

#userEventTriggered

Constructor Details

#initializeIdleHandler

Returns a new instance of IdleHandler.



25
26
27
28
# File 'lib/websocket/idle_handler.rb', line 25

def initialize
  # Include additional subclass initialization here.
  super()
end

Instance Method Details

#handle_idle_channel(ctx, _evt) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/websocket/idle_handler.rb', line 30

def handle_idle_channel(ctx, _evt)
  klass = self.class.name
  log.debug "#{klass} < IdleStateUserEventHandler ##{__method__}"
  message = TextWebSocketFrame.new("\nDisconnecting idle session\n")
  # TODO: Test
  ctx.writeAndFlush(message).sync
  ctx.close
  # ctx.channel.writeAndFlush(message).sync
  # ctx.channel.disconnect().awaitUninterruptibly()
  # ctx.channel.close().awaitUninterruptibly()
end