Map<String, dynamic> toMap() { return { 'action': action, 'type': type, 'socket': socket.toMap(), }; }