|Modifier and Type||Method and Description|
Adds message sender.
Connect to the specified uri.
Connect to the specified web server.
<T> JsonMessages.Factory addHandler(T handler)
Handler is an object with methods annotated with
Each such method must take exactly one argument whose type should implement
JsonMessage interface and be annotated with
Such method will be called when message of matching type will be received.
Optionally handler method can return
JsonMessage object which will be then
sent back to the message sender.
<T> SenderProvider<T> addSender(Class<T> senderClass)
Message sender allows you to send messages through WebSocket. The approach here is similiar
to that of Spring Data. You provide an interface with sender methods. Each such method
should take exactly one argument whose type should implement
and be annotated with
JsonTypeName. The returned object
you to retrieve implementation of the interface for given
You can then call sender methods to send given message.
After the connection is established any registered handlers can be called when matching message will be received through this Web Socket.
Copyright © 2013 Atteo. All rights reserved.