use onMessage for localStorage communication