Remove 'self' in 'writeImage_' and websockets messaging in this function as it's not needed.