Method: Whatup::Server::Server#initialize

Defined in:
lib/whatup/server/server.rb

#initialize(ip: 'localhost', port:) ⇒ Whatup::Server::Server

Returns The created server.

Parameters:

  • ip (String) (defaults to: 'localhost')

    The ip address to run the server on

  • port (Integer)

    The port to run the server on



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/whatup/server/server.rb', line 34

def initialize ip: 'localhost', port:
  @ip = ip
  @port = port
  @address = "#{@ip}:#{@port}"

  @clients = []
  @rooms = []

  @pid = Process.pid
  @pid_file = "#{Dir.home}/.whatup.pid"

  DbInit.setup_db!
end