Class: SCXMLClient

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

Defined Under Namespace

Classes: StatefulProtocol

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_interactor, _name) ⇒ SCXMLClient

Returns a new instance of SCXMLClient.



93
94
95
96
97
# File 'lib/MINT-core/manager/scxml_client.rb', line 93

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

end

Instance Attribute Details

#connectionsObject

Returns the value of attribute connections.



11
12
13
# File 'lib/MINT-core/manager/scxml_client.rb', line 11

def connections
  @connections
end

Class Method Details

.state_storeObject



13
14
15
# File 'lib/MINT-core/manager/scxml_client.rb', line 13

def self.state_store
 @@state_store ||= {}
end

Instance Method Details

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



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/MINT-core/manager/scxml_client.rb', line 99

def start(host="0.0.0.0",port=3003)

  StatefulProtocol.config(host,port)

  #socket = EM.connect(host, port, StatefulProtocol) do |conn|
  EventMachine::start_server host, port, StatefulProtocol do |conn|
   # conn.config(host,port)
    conn.subscribe_redis(@interactor,@name)
    #@connections << conn

    puts "SCXML Tool connection..."

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