Method: WebSocket::InstanceMethods#run
- Defined in:
- lib/websocket/instance_methods.rb
#run(params = {}) ⇒ Object
rubocop: disable Metrics/AbcSize rubocop: disable Metrics/MethodLength
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/websocket/instance_methods.rb', line 32 def run(params = {}) @options.merge!(params) channel = bootstrap.bind(port).sync().channel() channel_group.add(channel) ::WebSocket::ShutdownHook.new(self) log.info "Listening on #{channel.local_address}" channel.closeFuture().sync() rescue java.net.BindException => e raise "Bind error: #{e.}: #{@options[:host]}:#{port}" rescue java.net.SocketException => e raise "Socket error: #{e.}: #{@options[:host]}:#{port}" ensure stop end |