websocket reconnect

Hello, How reconnect websocket after error?

webix.proxy.socket = {
	$proxy:true,
	timer: 5,
	connectAttempt: 1,
	load:function(view) {
		this.socket = new WebSocket("ws://0.0.0.0:8000");
		this.socket.onopen = function() {
			alert("Соединение установлено.");
			this.connectAttempt = 1;
		};

		this.socket.onerror = (error) => {
			console.log("WebSocket Error", error);
			webix.message({type:'error', text:'Нет связи с сервером, переподключение через '+this.timer*this.connectAttempt+' сек.'});
			setTimeout(() => this.socket = new WebSocket("ws://0.0.0.0:8000"), this.timer*this.connectAttempt*1000);
		};

		this.socket.onmessage = (e) => {
			var update = webix.DataDriver.json.toObject(e.data);
			console.log("update", update);
			if(update.key != this.key) return;

			if(update.clientId == this.clientId){
				if(update.operation == "insert")
					view.data.changeId(update.id, update.data.id);
			}else{
				webix.dp(view).ignore(() => {
					if (update.operation == "delete")
						view.remove(update.data.id);
					else if (update.operation == "insert")
						view.add(update.data);
					else if (update.operation == "update"){
						view.updateItem(update.data.id, update.data);
					}
				});
			}
		};

		view.attachEvent("onDestruct", () => {
			this.socket.close();
		});
	},
	save:function(view, update) {
		update.clientId = this.clientId;
		update.key = this.key;
		update.session_id = document.cookie.substring(10);
		this.socket.send(webix.stringify(update));
	}
};

Hello, @Roman

The basic guide for integration with WebSockets is represented in our blog.
As for the issue, it’s possible to set a handler for the “re-created” this.socket and limit the number of the attempts for connectAttempt
Please, check the snippet here: Code Snippet