@Override @SuppressWarnings("unchecked") public synchronized Listener onEvent(String event, Consumer listener) { Listeners listeners = eventListeners.get(event); if (listeners == null) { listeners = new Listeners(); eventListeners.put(event, listeners); parent.onEvent(event, message -> handleEvent(event, (InstanceEvent) message)); } return listeners.add(listener); }
@Override public Listener<Session> onClose(Consumer<Session> listener) { return closeListeners.add(Assert.notNull(listener, "listener")); }
@Override public Listener<Session> onOpen(Consumer<Session> listener) { return openListeners.add(Assert.notNull(listener, "listener")); }