}
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof SubscribeEvent) {
SubscribeEvent subscribe = (SubscribeEvent) event;
String messageClientId = subscribe.getClientId();
Map<String, String> body = new HashMap<String, String>();
body.put("userId", subscribe.getSource().toString());
body.put("chatMessage", "I am connected.");
flexTemplate.send(new EventMessageCreator(event.getSource().toString(), messageClientId, "si-chat-receiver", body));
} else if (event instanceof UnsubscribeEvent) {
UnsubscribeEvent unsubscribe = (UnsubscribeEvent) event;
String messageClientId = unsubscribe.getClientId();