Class MessageProtocolDispatcher
java.lang.Object
com.inductiveautomation.perspective.gateway.session.MessageProtocolDispatcher
- Direct Known Subclasses:
PageModel.Handlers
Handles some boilerplate for classes that can handle receiving messages from a websocket channel. Basically
just a fancy wrapper around a map of protocol handling messages.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMessageProtocolDispatcher(com.inductiveautomation.ignition.common.gson.Gson gson, LoggerEx log) -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected voidonFatalError(MessageChannel channel, String message) protected voidonFatalError(MessageChannel channel, String message, Throwable t) voidreceive(MessageChannel channel, String protocol, Reader payload) <T> voidregister(String protocol, BiConsumer<MessageChannel, T> handler, Class<T> clazz) voidtrySend(MessageChannel channel, String protocol, com.inductiveautomation.ignition.common.gson.JsonObject payload) Handy wrapper around MessageChannel.send that logs a warning upon failure.voidtrySend(MessageChannel channel, String protocol, Object payload) Handy wrapper around MessageChannel.send that logs a warning upon failure.voidtrySendInternal(MessageChannel channel, String protocol, String payload)
-
Field Details
-
handlers
-
-
Constructor Details
-
MessageProtocolDispatcher
public MessageProtocolDispatcher(com.inductiveautomation.ignition.common.gson.Gson gson, LoggerEx log)
-
-
Method Details
-
receive
-
register
-
handles
-
onFatalError
-
onFatalError
-
trySend
public void trySend(MessageChannel channel, String protocol, com.inductiveautomation.ignition.common.gson.JsonObject payload) Handy wrapper around MessageChannel.send that logs a warning upon failure. -
trySend
Handy wrapper around MessageChannel.send that logs a warning upon failure.- Parameters:
payload- An object that will be gson-serialized automatically.
-
trySendInternal
-