class ControlWebsocketHandler {

	public void initiateControlSignal(Map<String, String> oldConfigMap, Map<String, String> newConfigMap) {
		// Compare the old and new config map
		Map<String, ChannelHandlerContext> controlMap = WebSocketMap.controlWebsocketMap;
		ArrayList<String> changedConfigElmtsList = new ArrayList<>();
		if (newConfigMap != null && newConfigMap.size() > 0) {
			for (Map.Entry<String, String> newEntry : newConfigMap.entrySet()) {
				String newMapKey = newEntry.getKey();
				if (!oldConfigMap.containsKey(newMapKey)) {
					changedConfigElmtsList.add(newMapKey);
				} else {

					String newConfigValue = newEntry.getValue();
					String oldConfigValue = oldConfigMap.get(newMapKey);
					if (!newConfigValue.equals(oldConfigValue)) {
						changedConfigElmtsList.add(newMapKey);
					}
				}
			}
		}


		for (String changedConfigElmtId : changedConfigElmtsList) {
			if (controlMap.containsKey(changedConfigElmtId)) {
				ChannelHandlerContext ctx = controlMap.get(changedConfigElmtId);
				WebSocketMap.unackControlSignalsMap.put(ctx, new ControlSignalSentInfo(1, System.currentTimeMillis()));

				ByteBuf buffer1 = ctx.alloc().buffer();
				buffer1.writeByte(OPCODE_CONTROL_SIGNAL);
				ctx.channel().writeAndFlush(new BinaryWebSocketFrame(buffer1));
			}
		}
	}

}