All Downloads are FREE. Search and download functionalities are using the official Maven repository.

donky.microsoft.aspnet.signalr.client.hubs.Subscription Maven / Gradle / Ivy

There is a newer version: 2.7.0.3
Show newest version
/*
Copyright (c) Microsoft Open Technologies, Inc.
All Rights Reserved
See License.txt in the project root for license information.
*/

package donky.microsoft.aspnet.signalr.client.hubs;

import java.util.ArrayList;
import java.util.List;

import donky.microsoft.aspnet.signalr.client.Action;

import com.google.gson.JsonElement;

/**
 * Represents a subscription to a message
 */
public class Subscription {
    private List> mReceived = new ArrayList>();

    /**
     * Triggers the "Received" event
     * 
     * @param data
     *            Event data
     * @throws Exception
     */
    void onReceived(JsonElement[] data) throws Exception {
        for (Action handler : mReceived) {
            handler.run(data);
        }
    }

    /**
     * Add a handler to the "Received" event
     * 
     * @param received
     *            Event handler
     */
    public void addReceivedHandler(Action received) {
        mReceived.add(received);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy