/* removeConnection does the house keeping for removing a connection to the hub */ func (self *Hub) removeConnection(conn interfaces.Connection) error { b, err := self.isRegisteredConnection(conn) if err != nil { return errors.New("cannot remove connection: " + err.Error()) } if !b { return errors.New("connection is not registered") } conn.SetHub(nil) self.removeConnectionSubscriptions(conn) delete(self.connections, conn) sendChan := conn.SendChannel() close(sendChan) return nil }