     }
     
     public func unsubscribe(_ topic : String, channel : Int, callback : io.magistral.client.sub.Callback?) throws {
-        var hts = self.subKey + "/" + topic.replacingOccurrences(of: "/", with: "-").replacingOccurrences(of: ".", with: "-");
+        let hts = self.subKey + "/" + topic.replacingOccurrences(of: "/", with: "-").replacingOccurrences(of: ".", with: "-");
         
         self.mqtt?.unsubscribe(hts, channel: channel, callback: { meta, err in
             callback?(io.magistral.client.sub.SubMeta(topic: meta.topic(), channel: meta.channel(), group: meta.group(), endPoints: meta.endPoints()), err);

            "channel": channels
        ]
        
        RestApiManager.sharedInstance.makeHTTPGetRequest(path: baseURL, parameters: params, user: user, password : self.secretKey, onCompletion: { json, err in
            do {
                
                let messages = try JsonConverter.sharedInstance.handleMessageEvent(json: json);
                
                for m in messages {
                    
                    if let chixs = self.init_indexes[m.topic()] {
                        if let ixs = chixs[m.channel()] {
                            if m.index() > ixs {
                                listener(m, nil)
                                self.init_indexes[m.topic()]?[m.channel()] = m.index()
                            }
                        } else {
                            listener(m, nil)
                            self.init_indexes[m.topic()]?[m.channel()] = m.index()                                }
                    } else {
                        listener(m, nil)
                        self.init_indexes[m.topic()] = [ : ]
                        self.init_indexes[m.topic()]?[m.channel()] = m.index()
                    }
                }
                callback();

                        for _ch in meta.channels() {
                            xx.append(_ch)
                        }
                        self.read(topic, group: group, channels: xx, listener: listener, callback: { [weak self] in
                            self?.mqtt?.subscribe(topic, channel: ch, group: group, qos: .atLeastOnce, callback : { meta, err in
                                callback?(meta, err)
                            })
                        });
