import time

def close_websckt():
	fc = system.tag.readBlocking(["Configuration/FC"])
	fc_value = fc[0].value
	tag_provider = "[%s_SCADA_TAG_PROVIDER]" % (fc_value)
	system.tag.writeBlocking([tag_provider + "System/close_socket"],[1])
	time.sleep(1)
	system.tag.writeBlocking([tag_provider + "System/close_socket"],[0])
	logger = system.util.getLogger("%s-Project-Update" % (fc))
	logger.info("Web-Socket closed due to project update")

def check_web_socket():
	request_to_close = system.tag.readBlocking(["System/close_socket"])
	request_to_close_val = request_to_close[0].value
	if request_to_close_val:
		return True
	else:
		return False
