-
Notifications
You must be signed in to change notification settings - Fork 47
Emit dial events rather than logging them #563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions
// eslint-disable-next-line no-console | ||
console.debug('Reconnected successfully!'); | ||
this.emit(MachineConnectionEvent.DIAL_EVENT, { | ||
message: 'Reconnected successfully', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a DIAL_EVENT
and not CONNECTED
?
await client.connect({ | ||
priority: conf.priority, | ||
dialTimeout: conf.dialTimeout ?? DIAL_TIMEOUT, | ||
creds: conf.credentials, | ||
}); | ||
|
||
// eslint-disable-next-line no-console | ||
console.debug('connected via WebRTC'); | ||
client.emit(MachineConnectionEvent.DIAL_EVENT, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, why is this a DIAL_EVENT
and not CONNECTED
?
@@ -9,21 +9,22 @@ export enum MachineConnectionEvent { | |||
CONNECTED = 'connected', | |||
DISCONNECTING = 'disconnecting', | |||
DISCONNECTED = 'disconnected', | |||
DIAL_EVENT = 'dialing', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is DIALING
different than CONNECTING
?
Solved by #619 |
Currently we don't allow end-users to consume dial events, we only log them to the JS console. Logging isn't a good idea for production apps because:
This PR improves both situations by instead having the RobotClient emit dial events, which we can present in UIs, and removing logs.