Implement JS message handling