client/events.go
func (e *EventListener) RemoveHandler(target *EventTarget) error {
	if target == nil {
		return fmt.Errorf("A valid event target must be provided")
	}

	// Handle locking
	e.targetsLock.Lock()
	defer e.targetsLock.Unlock()

	// Locate and remove the function from the list
	for i, entry := range e.targets {
		if entry == target {
			copy(e.targets[i:], e.targets[i+1:])
			e.targets[len(e.targets)-1] = nil
			e.targets = e.targets[:len(e.targets)-1]
			return nil
		}
	}

	return fmt.Errorf("Couldn't find this function and event types combination")
}
func (e *EventListener) RemoveHandler(target *EventTarget) error {
	if target == nil {
		return fmt.Errorf("A valid event target must be provided")
	}

	// Handle locking
	e.targetsLock.Lock()
	defer e.targetsLock.Unlock()

	// Locate and remove the function from the list
	for i, entry := range e.targets {
		if entry == target {
			copy(e.targets[i:], e.targets[i+1:])
			e.targets[len(e.targets)-1] = nil
			e.targets = e.targets[:len(e.targets)-1]
			return nil
		}
	}

	return fmt.Errorf("Couldn't find this function and event types combination")
}
// RemoveHandler removes a function to be called whenever an event is received