Class: Quark::MdkProtocol::OpenCloseSubscriber
Overview
Handle Open and Close messages.
Constant Summary
DatawireQuarkCore::Static::Unassigned
Instance Attribute Summary collapse
Instance Method Summary
collapse
_lazy_statics, static, unlazy_statics
#to_s
Constructor Details
#initialize(client, node_id, environment) ⇒ OpenCloseSubscriber
Returns a new instance of OpenCloseSubscriber.
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
|
# File 'lib/mdk_protocol.rb', line 1072
def initialize(client, node_id, environment)
self.__init_fields__
(self)._wsclient = client
(self)._node_id = node_id
(self)._environment = environment
(self)._wsclient.subscribe(self)
nil
end
|
Instance Attribute Details
#_dispatcher ⇒ Object
Returns the value of attribute _dispatcher.
1065
1066
1067
|
# File 'lib/mdk_protocol.rb', line 1065
def _dispatcher
@_dispatcher
end
|
#_environment ⇒ Object
Returns the value of attribute _environment.
1065
1066
1067
|
# File 'lib/mdk_protocol.rb', line 1065
def _environment
@_environment
end
|
#_node_id ⇒ Object
Returns the value of attribute _node_id.
1065
1066
1067
|
# File 'lib/mdk_protocol.rb', line 1065
def _node_id
@_node_id
end
|
#_wsclient ⇒ Object
Returns the value of attribute _wsclient.
1065
1066
1067
|
# File 'lib/mdk_protocol.rb', line 1065
def _wsclient
@_wsclient
end
|
Instance Method Details
#__init_fields__ ⇒ Object
1199
1200
1201
1202
1203
1204
1205
1206
1207
|
# File 'lib/mdk_protocol.rb', line 1199
def __init_fields__()
self._dispatcher = nil
self._wsclient = nil
self._node_id = nil
self._environment = nil
nil
end
|
#_getClass ⇒ Object
1155
1156
1157
1158
1159
1160
|
# File 'lib/mdk_protocol.rb', line 1155
def _getClass()
return "mdk_protocol.OpenCloseSubscriber"
nil
end
|
#_getField(name) ⇒ Object
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
|
# File 'lib/mdk_protocol.rb', line 1162
def _getField(name)
if ((name) == ("_dispatcher"))
return (self)._dispatcher
end
if ((name) == ("_wsclient"))
return (self)._wsclient
end
if ((name) == ("_node_id"))
return (self)._node_id
end
if ((name) == ("_environment"))
return (self)._environment
end
return nil
nil
end
|
#_setField(name, value) ⇒ Object
#onClose(close) ⇒ Object
1148
1149
1150
1151
1152
1153
|
# File 'lib/mdk_protocol.rb', line 1148
def onClose(close)
(self)._wsclient.onClose((close).error)
nil
end
|
#onMessage(origin, message) ⇒ Object
1093
1094
1095
1096
1097
1098
|
# File 'lib/mdk_protocol.rb', line 1093
def onMessage(origin, message)
::Quark.mdk_protocol._subscriberDispatch(self, message)
nil
end
|
#onMessageFromServer(message) ⇒ Object
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
|
# File 'lib/mdk_protocol.rb', line 1107
def onMessageFromServer(message)
type = (::Quark.quark.reflect.QuarkClass.get(::DatawireQuarkCore._getClass(message))).id
if ((type) == ("mdk_protocol.Open"))
self.onOpen()
return
end
if ((type) == ("mdk_protocol.Close"))
close = ::DatawireQuarkCore.cast(message) { ::Quark.mdk_protocol.Close }
self.onClose(close)
return
end
nil
end
|
#onOpen ⇒ Object
1141
1142
1143
1144
1145
1146
|
# File 'lib/mdk_protocol.rb', line 1141
def onOpen()
nil
nil
end
|
#onPump ⇒ Object
1134
1135
1136
1137
1138
1139
|
# File 'lib/mdk_protocol.rb', line 1134
def onPump()
nil
nil
end
|
#onStart(dispatcher) ⇒ Object
1086
1087
1088
1089
1090
1091
|
# File 'lib/mdk_protocol.rb', line 1086
def onStart(dispatcher)
(self)._dispatcher = dispatcher
nil
end
|
#onStop ⇒ Object
1100
1101
1102
1103
1104
1105
|
# File 'lib/mdk_protocol.rb', line 1100
def onStop()
nil
nil
end
|
#onWSConnected(websocket) ⇒ Object
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
|
# File 'lib/mdk_protocol.rb', line 1123
def onWSConnected(websocket)
open = ::Quark.mdk_protocol.Open.new()
(open).mdkVersion = "2.0.37"
(open).nodeId = (self)._node_id
(open).environment = @_environment
(self)._dispatcher.tell(self, open.encode(), websocket)
nil
end
|