let baseUrl = 'ws://localhost:12345';
let ws;
let subject = {};
let reconnectInterval = 3000;
let connect = function () {
	ws = new WebSocket(baseUrl);
	ws.onopen = () => {
		console.log('already connected');
		ws.send('websocket connected');
	};
	ws.onerror = () => {
		console.log('error');
	};
	ws.onclose = () => {
		console.log('websocket closed');
		setTimeout(connect, reconnectInterval);
	};
};
connect();

/***************************************************公共方法***********************************************************/