Class: Quark::MdkRuntime::QuarkRuntimeWebSockets

Inherits:
DatawireQuarkCore::QuarkObject show all
Extended by:
DatawireQuarkCore::Static
Defined in:
lib/mdk_runtime.rb

Constant Summary

Constants included from DatawireQuarkCore::Static

DatawireQuarkCore::Static::Unassigned

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DatawireQuarkCore::Static

_lazy_statics, static, unlazy_statics

Methods inherited from DatawireQuarkCore::QuarkObject

#to_s

Constructor Details

#initializeQuarkRuntimeWebSockets

Returns a new instance of QuarkRuntimeWebSockets.



1195
1196
1197
1198
1199
# File 'lib/mdk_runtime.rb', line 1195

def initialize()
    self.__init_fields__

    nil
end

Instance Attribute Details

#connectionsObject

Returns the value of attribute connections.



1187
1188
1189
# File 'lib/mdk_runtime.rb', line 1187

def connections
  @connections
end

#dispatcherObject

Returns the value of attribute dispatcher.



1187
1188
1189
# File 'lib/mdk_runtime.rb', line 1187

def dispatcher
  @dispatcher
end

#loggerObject

Returns the value of attribute logger.



1187
1188
1189
# File 'lib/mdk_runtime.rb', line 1187

def logger
  @logger
end

Instance Method Details

#__init_fields__Object



1279
1280
1281
1282
1283
1284
1285
1286
# File 'lib/mdk_runtime.rb', line 1279

def __init_fields__()
    
    self.logger = ::Quark.quark._getLogger("protocol")
    self.dispatcher = nil
    self.connections = ::DatawireQuarkCore::List.new([])

    nil
end

#_getClassObject



1241
1242
1243
1244
1245
1246
# File 'lib/mdk_runtime.rb', line 1241

def _getClass()
    
    return "mdk_runtime.QuarkRuntimeWebSockets"

    nil
end

#_getField(name) ⇒ Object



1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
# File 'lib/mdk_runtime.rb', line 1248

def _getField(name)
    
    if ((name) == ("logger"))
        return (self).logger
    end
    if ((name) == ("dispatcher"))
        return (self).dispatcher
    end
    if ((name) == ("connections"))
        return (self).connections
    end
    return nil

    nil
end

#_setField(name, value) ⇒ Object



1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
# File 'lib/mdk_runtime.rb', line 1264

def _setField(name, value)
    
    if ((name) == ("logger"))
        (self).logger = value
    end
    if ((name) == ("dispatcher"))
        (self).dispatcher = ::DatawireQuarkCore.cast(value) { ::Quark.mdk_runtime.actors.MessageDispatcher }
    end
    if ((name) == ("connections"))
        (self).connections = ::DatawireQuarkCore.cast(value) { ::DatawireQuarkCore::List }
    end

    nil
end

#connect(url, originator) ⇒ Object



1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
# File 'lib/mdk_runtime.rb', line 1204

def connect(url, originator)
    
    @logger.debug((((originator).to_s) + ("requested connection to ")) + (url))
    factory = ::Quark.mdk_runtime.promise.PromiseResolver.new((self).dispatcher)
    actor = ::Quark.mdk_runtime.QuarkRuntimeWSActor.new(url, originator, factory)
    (@connections) << (actor)
    (self).dispatcher.startActor(actor)
    return (factory).promise

    nil
end

#onMessage(origin, message) ⇒ Object



1223
1224
1225
1226
1227
1228
# File 'lib/mdk_runtime.rb', line 1223

def onMessage(origin, message)
    
    nil

    nil
end

#onStart(dispatcher) ⇒ Object



1216
1217
1218
1219
1220
1221
# File 'lib/mdk_runtime.rb', line 1216

def onStart(dispatcher)
    
    (self).dispatcher = dispatcher

    nil
end

#onStopObject



1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
# File 'lib/mdk_runtime.rb', line 1230

def onStop()
    
    idx = 0
    while ((idx) < ((@connections).size)) do
        (self).dispatcher.tell(self, ::Quark.mdk_runtime.WSClose.new(), ((self).connections)[idx])
        idx = (idx) + (1)
    end

    nil
end