Package org.syncany.operations.watch
Class NotificationListener
- java.lang.Object
-
- org.syncany.operations.watch.NotificationListener
-
public class NotificationListener extends java.lang.Object
The notification listener implements a client to the fanout, as very lightweight pub/sub server originally written for SparkleShare.Fanout implements a simple TCP-based plaintext protocol.
It implements the following commands:subcribe <channel>
unsubscribe <channel>
announce <channel> <message>
Notifications have the following format:
<channel>!<message>
The notification listener starts a thread and listens for incoming messages. Outgoing messages (subscribe/unsubscribe/announce) are sent directly or (if that fails), put in an outgoing queue. Incoming messages are handed over to a
NotificationListener.NotificationListenerListener
.- See Also:
- https://github.com/travisghansen/fanout/ - Fanout source code by Travis G. Hansen
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
NotificationListener.NotificationListenerListener
-
Constructor Summary
Constructors Constructor Description NotificationListener(java.lang.String host, int port, NotificationListener.NotificationListenerListener listener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
announce(java.lang.String channel, java.lang.String message)
void
start()
void
stop()
void
subscribe(java.lang.String channel)
void
unsubscribe(java.lang.String channel)
-
-
-
Constructor Detail
-
NotificationListener
public NotificationListener(java.lang.String host, int port, NotificationListener.NotificationListenerListener listener)
-
-
Method Detail
-
start
public void start()
-
stop
public void stop()
-
subscribe
public void subscribe(java.lang.String channel)
-
unsubscribe
public void unsubscribe(java.lang.String channel)
-
announce
public void announce(java.lang.String channel, java.lang.String message)
-
-