class ExtensionWebSocketClient {

    public void sendNotification(Object data) {

        if (data != null && (data.getClass().isArray() || data instanceof List)) {
            throw new IllegalArgumentException("Notifications cannot be lists or arrays.");
        }
        if (isConnected()) {
            Map<String,Object> m = new LinkedHashMap<>();
            m.put("op", ExtensionServiceMessage.OP_NOTIFICATION);
            m.put("resourceId", sourceName);
            m.put("resourceName", ExtensionServiceMessage.RESOURCE_NAME_SOURCES);
            m.put("object", data);
            ExtensionServiceMessage msg = new ExtensionServiceMessage("");
            msg.fromMap(m);
            try {
                outstandingNotifications.acquire();
                this.send(msg);
            } catch (InterruptedException ie) {
                log.warn("Obtaining space to sent notifications was interrupted.", ie);
            } catch (Exception e) {
                // If we get an exception during the send, we're unlikely to get a response so release now.
                outstandingNotifications.release();
                throw e;
            }
        }
    }

    public  ExtensionWebSocketClient(String sourceName);

}