Class: SCXMLServer

Inherits:
Object
  • Object
show all
Defined in:
lib/MINT-core/manager/scxml_server.rb

Defined Under Namespace

Classes: StatefulProtocol

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_interactor, _name) ⇒ SCXMLServer

Returns a new instance of SCXMLServer.



67
68
69
70
# File 'lib/MINT-core/manager/scxml_server.rb', line 67

def initialize(_interactor,_name)
  @interactor = _interactor
  @name = _name
end

Instance Attribute Details

#connectionsObject

Returns the value of attribute connections.



8
9
10
# File 'lib/MINT-core/manager/scxml_server.rb', line 8

def connections
  @connections
end

#managerObject

Returns the value of attribute manager.



9
10
11
# File 'lib/MINT-core/manager/scxml_server.rb', line 9

def manager
  @manager
end

Instance Method Details

#start(host = "0.0.0.0", port = 3001) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/MINT-core/manager/scxml_server.rb', line 72

def start(host="0.0.0.0",port=3001)
EventMachine::start_server host, port, StatefulProtocol do |conn|
    conn.subscribe_redis(@interactor,@name)
    @connections << conn

    puts "connection..."

    # inform about all currently activated states
    # @state_store[@interactor]
  end
  puts "Started server on #{host}:#{port}"
end